How to understand variables in Python

variable

In Python, to store a data, you need to define a variable

number1 = 1 #numbe1 is a variable used to store data: 1

number2 = 2 #number2 is also a variable, used to save data: 2

sum = number1+number2 #sum is also a variable, save the value of 1+2 hard

Description:

The so-called variable: is the amount that can be changed.

Programs are used to process data, and variables are used to store data

Variables in python do not need to specify the type, the system will automatically recognize

Content expansion:

Variable naming

1、 Start with an underscore or uppercase and lowercase letters, followed by any combination of underscores, uppercase and lowercase letters, and numbers (but generally, the beginning of an underscore has a special meaning and is not recommended)

2、 It is recommended to use English words or abbreviations with fixed meanings, such as srv = server, skt = socket, generally based on posix naming rules

3、 Recommended hump writing: Big hump is used to write classes, such as MyFirstLove, small hump such as myFirstLove or posix is used to write variable or function names. Compared with the two, posix is currently recommended, such as: my_first_love

4、 Avoid reserved words and keywords, such as class, def, break, for; (print out all keywords of the system, import keyword; // first cause the keyword module print (keyword.kwlist)//print)

This is the end of this article on how to understand variables in Python. For more information about the meaning of variables in Python, please search ZaLou.Cn

Recommended Posts

How to understand variables in Python
How to understand global variables in Python
How to clear variables in python
How to understand python objects
How to wrap in python code
How to omit parentheses in Python
How to understand the introduction of packages in Python
How to write classes in python
How to filter numbers in python
How to read Excel in Python
How to write return in python
How to understand python object-oriented programming
How to use SQLite in Python
How to use and and or in Python
How to introduce third-party modules in Python
How to represent null values in python
How to write win programs in python
How to install third-party modules in Python
How to custom catch errors in python
How to write try statement in python
How to define private attributes in Python
How to view installed modules in python
How to open python in different systems
How to add background music in python
How to represent relative path in python
How to use the round function in python
How to program based on interfaces in Python
How to install python in ubuntu server environment
An article to understand the yield in Python
How to use code running assistant in python
Teach you how to write games in python
How to delete files and directories in python
How to install the downloaded module in python
How to write a confession program in python
How to perform continuous multiplication calculation in python
How to comment python code
How to learn python quickly
How to uninstall python plugin
How to use python tuples
Example of how to automatically download pictures in python
How to save IE as an attachment in python
How to create a Python virtual environment in Ubuntu 14.04
python how to view webpage code
How to use hanlp in ubuntu
How to use python thread pool
How to find the area of a circle in python
How to install PHP7.4 in CentOS
How to save the python program
How to install mysql in Ubuntu 14.04
How to install Python 3.8 on CentOS 8
How to install Python 3.8 on Ubuntu 18.04
How to install Python on CentOS 8
How to install HDP2.6 in Centos7.2
How to solve python dict garbled
How to install mysql in Ubuntu 14.04
Do you still know how to draw cakes in python? ? ?
How to view the python module
How to install Android SDK in centos7
How to add swap partition in Ubuntu
How to verify successful installation of python
How to easily compile openJDK in Ubuntu