zoukankan      html  css  js  c++  java
  • 变量

    1.定义

    • 变量即变化的量,核心是“变”与“量”二字,变即变化,量即衡量状态。

    2.组成

    • 变量名、等号、变量值
    • 变量名定义规范:1)字母、数字及下划线组成。2)首字母不能为数字;
    • 3)python中关键字不能为变量名('and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del',

      'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not',

      'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield')

    3.变量名格式

    • 驼峰体(首字母大写)
    • 下划线(推荐使用)
      number_of_students = 80

    4.知识点

    定义变量会有ID/Type/value

    ***等号比较的是Value;is比较的是ID***

    ***ID相同,即Value与type必定相同;反之,Value相等,type必定相同,但ID不一定相同***

    >>> x='Info Egon:18'
    >>> y='Info Egon:18'
    >>> id(x)
    4376607152
    >>> id(y)
    4376607408
    >>> 
    >>> x == y
    True
    >>> x is y
    False
  • 相关阅读:
    docker 镜像相关
    docker相关网站
    docker初识 一
    loadrunner Windows资源指标
    Codeforces Round #368 (Div. 2) Brain's Photos
    CodeForce 589J Cleaner Robot
    CodeForce 677I Lottery
    CodeForce 677D Boulevard
    CodeForce 589B Layer Cake
    Map的遍历
  • 原文地址:https://www.cnblogs.com/datatool/p/13293586.html
Copyright © 2011-2022 走看看