Python development [2] basics and python Development

Source: Internet
Author: User

Python development [2] basics and python Development
Initial recognition of Variables

Variable is a new knowledge point and a concept that needs to be well known when learning Python. Python is a dynamic type language. It can be bound to a value of different types during the assignment execution. This process is called the variable assignment operation. The assignment also determines the type of the variable.

Variable naming rules
  • A variable consists of letters, numbers, and underscores.
  • A variable cannot start with a number. For example, 2abc is an incorrect variable name.
  • Variables are case sensitive, such as name! = Name
  • Variables must be named by meaningful characters.
  • Variables cannot be named using keywords defined in Python.
Variable assignment
>>> X = 5 this operation is to assign a value, which means to assign the integer number 5 to the variable x and connect the variable name and value with an equal sign. Then you can use the new variable in the expression. >>> X * 315 Note: When a value is assigned, the Data Type of the value determines the type of the variable. The variable name references the value and its type.
Note

Single line comment #

Comment ''' or "" on multiple lines """

Note: ''' or "can be used not only for commenting, but also for assigning values to variables. For example:

Msg = "----------- info of liqiang ------------- Name: liqiang Age: 29 Job: IT Salary: 3000 ---------------- end ------------------" print (msg) the output result is as follows: ----------- info of liqiang ------------- Name: liqiang Age: 29 Job: IT Salary: 3000 ---------------- end --------------------

  

 

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.