Python Note 2-variables

Source: Internet
Author: User

Variable

Used to store things

#定义变量
Name=' Feifei '#定义变量, string
Age=18.9#整型或者小数定义变量不需要加引号
Print (name)
Print (age)
Name2= "What ' s your name"#里面有单引号外面就用双引号
Name3= ' You look very handsome'#里面是双引号外面就用单引号
Name4=""you look very handsome "#里面既有双引号又有单引号就用三引号标记
#ctrl +/Quick Notes
#3个单引号还能进行段落的注释

Rules for defining variables:

Variable name to see the name to know, can not write, blind write to the back of their own can not understand what the variable is dry, do not use pinyin, so very low, not to use Chinese as a variable name, it is 2b programmers do, but Python can be used in Chinese as the variable name!

Variable names can only be any combination of letters, numbers, or underscores
The first character of a variable name cannot be a number

The following keywords cannot be declared as variable names

[' and ', ' as ', ' assert ', ' Break ', ' class ', ' Continue ', ' Def ', ' del ', ' elif ', ' Else ', ' except ', ' exec ', ' finally ',

' For ', ' from ', ' global ', ' if ', ' import ', ' in ', ' was ', ' lambda ', ' not ', ' or ', ' pass ', ' print ', ' raise ', ' return ',

' Try ', ' while ', ' with ', ' yield ']

Python Note 2-variables

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.