Python variables (Assignment, data type, data type conversion)

Source: Internet
Author: User

There are three ways to assign a Python variable;

1. Direct assignment: Age = 28

2. Multiple variable assignment age, sex = 1 #每个变量都必须要有个对应的值

3. Special form Assignment A = b = 28

Note that variables must be assigned before they are used, which differs from C + + because there is no type modifier in front of the python variable, and storage space cannot be allocated;

Variable names cannot be named by keywords; they can only be named by letters, numbers, and underscores, not by numbers, with an underscore, or as a variable name

Variable names are case-sensitive

Digression: Why use a variable name, there are 2 benefits:

1. Easy maintenance;

2. Save space for documents;

Two. Data type

Python variables (Assignment, data type, data type conversion)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.