crazy-heng
天降大任于斯人也...

导航

 

变量的作用:

Variables are uesd to store  information to be  referenced  and  manipulated in a computer . they also provide a way  of labeling data with a descriptive name, so our programs can be understood  more clearly by the reader and ourselves. it is helpful to think  of variablese as containers that hold  information their  sole  purpose is to label and store  data in memory this data can then be uesd throughout your  program

声明变量:

name = "alex"

name为变量名

alex为变量值

定义变量的规则:

变量名只能是 字母,数字 下划线的任意组合;

变量名的第一个字符不能是数字;

python中的语法不能作为变量命,如:print an in 等等

约定俗成的固定:

变量名不能用中文;

变量名不能用拼英;

变量名不能过长;

变量名不能词不达意

常量:

python中没有常量的固定语法,和变量形式一样,约定俗成将变量名全部大写视为常量。

posted on 2018-03-23 10:41  killer-147  阅读(100)  评论(0编辑  收藏  举报