Python (day1)-data types and variables

Source: Internet
Author: User

Data type:

Integers: integers, including positive integers, 0, negative integers

Floating point: In layman's words, it's a decimal.

Long integers: A long integer, usually followed by an L-

String: The string needs to be enclosed in "or". Single and double quotes can appear simultaneously, such as "I ' m jake!"

Boolean value: Only two True, False

Null: denoted by none, but not the same as 0. Since 0 is also a value, it is not empty.

Do you see the difference?

Variable:

Variable: consists of letters, numbers, and underscores, but cannot begin with a number. such as a, _a, A7 These are legal, 7a this is illegal.

When naming variables, there are usually several principles:

1. Cannot use keyword as variable name

2. The variable name is as explicit as possible, that is, to indicate the meaning of the variable, such as Age = 12, a

3. If the variable has more than one word, connect it with an underscore, such as My_name

4. The above variables can also capitalize the first letter of the word, such as MyName

Assignment of variables:

For example, age = 12, this completes the assignment. If it's a string, use quotation marks like name = ' Jack '

Python (day1)-data types and 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.