Sample Analysis of variables and data types in python
Editor to share with you the sample analysis of variables and data types in python, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Variables and data types
Assignment does not need to specify a type, how to define variables
# define rule variable name = data adept 10 # python does not declare data types, so values must be assigned when defining variables
Av10 # python does not declare data types, so you must assign a value to a=20print (a) # use a to define the variable before it can be used, the variable can be changed # the value can be changed during program execution
The value can be changed directly without definition.
Enter the python terminal directly from pycharm
Realize numerical access through variables
Output element type
Print (type (a))
# Advanced type b = () # meta-ancestor type print (type (b)) c = [] # # list type print (type (c)) d = {} # # dictionary type print (type (d))
Naming rules for variables in Python
Name='liudehua' # cannot start with a number print (Name) _ age=89print (_ age)
Name='qianiqan' # case-sensitive print (name) # color changes can be considered that the keyword cannot be the variable name True=10print (True)
Naming convention
The above is all the content of the article "sample Analysis of variables and data types in python". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!