Learning python - variable

Variable is used to store information and later use the program

Variables used:

. 1 name = ' ZWT ' 
2  print ( ' My name IS ' , name) // comma here is equivalent to splice indicating print parameters in 2
 . 3  
. 4 NAME2 = name
 . 5 name = ABC
 . 6  print (name, NAME2) // abc zwt
 7  
8 Note: this name2 or output zwt, because although the name of the value modified, but the address pointed to name2 or zwt. This time with the current name name2 has no relationship. name changed again, it will not affect the name2.

Variable naming rules:

  Variable names only letters, any combination of underscores, numbers

  The first character can not be a number of variables

  The following keywords can not be declared variable name

and as asset break class continue def of the elif else
except exec finally for form global if import in is
lambda have or pass print raise return try while with / yield

Guess you like

Origin www.cnblogs.com/ommph/p/11363573.html