No. 005: The Python data type of the chat

Source: Internet
Author: User

In Python, int represents an integer, do you remember what bool, float, and str represent separately?

A: BOOL is a Boolean type, float is a floating-point type, and Str is a string type

Do you know why the Boolean type (bool) of True and False is replaced by 1 and%?

A: Binary only: 0 and 1, with 0 and one representing False and True

Use INT () to convert a decimal number to an integer, the result of rounding up or down?

Answer: It is rounded down

Our human mind is accustomed to the "rounding" method, do you have any way to make int () in the way of "rounding" to take the whole?

Answer: Int (num+0.5)

To get a variable type, the video shows you can use type () and isinstance (), which do you prefer to use?

Answer: Type ()

Python3 can give the variable a name in Chinese, do you know why?

A: Python 3 is utf-8 encoded by default

This article is from the "Champion Small Lemon" blog, please make sure to keep this source http://lemonit.blog.51cto.com/6043645/1597866

No. 005: The Python data type of the chat

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.