Home > Backend Development > Python Tutorial > How to define variables in python

How to define variables in python

silencement
Release: 2020-09-18 17:37:28
Original
41381 people have browsed it

Use the "=" symbol to define a variable in python. The left side of the "=" symbol is the variable name, and the right side of the "=" symbol is the value of the variable. Python supports assigning values ​​to multiple variables at the same time. Specifying different values ​​for multiple variables is also supported.

How to define variables in python

#What are variables?

Variable: A quantity whose value will change, as opposed to a constant

Variable data types supported by python:

1. Number

2, string

3, list

4, tuple

5. Dictionary

Variable naming convention: variable names are all lowercase words, and each word is connected with _underscores to make it as clear as possible Name Zhiyi

The format of declaring variables: variable name = value (the type of value determines the type of variable) For example:

How to define variables in python

Assignment of multiple variables: Python supports assigning values ​​to multiple variables at the same time, as follows

How to define variables in python

Specifies different values ​​for multiple variables:

How to define variables in python

The above is the detailed content of How to define variables in python. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template