Variable
Used to store things
#定义变量
Name=' Feifei '#定义变量, string
Age=18.9#整型或者小数定义变量不需要加引号
Print (name)
Print (age)
Name2= "What ' s your name"#里面有单引号外面就用双引号
Name3= ' You look very handsome'#里面是双引号外面就用单引号
Name4=""you look very handsome "#里面既有双引号又有单引号就用三引号标记
#ctrl +/Quick Notes
#3个单引号还能进行段落的注释
Rules for defining variables:
Variable name to see the name to know, can not write, blind write to the back of their own can not understand what the variable is dry, do not use pinyin, so very low, not to use Chinese as a variable name, it is 2b programmers do, but Python can be used in Chinese as the variable name!
Variable names can only be any combination of letters, numbers, or underscores
The first character of a variable name cannot be a number
The following keywords cannot be declared as variable names
[' and ', ' as ', ' assert ', ' Break ', ' class ', ' Continue ', ' Def ', ' del ', ' elif ', ' Else ', ' except ', ' exec ', ' finally ', ' For ', ' from ', ' global ', ' if ', ' import ', ' in ', ' was ', ' lambda ', ' not ', ' or ', ' pass ', ' print ', ' raise ', ' return ', ' Try ', ' while ', ' with ', ' yield '] |
Python Note 2-variables