Python basic data Type Day2

Source: Internet
Author: User

operator

1. Arithmetic Operation:

2. Comparison operation:

3. Assignment Operation:

4. Logical Operation:

5. Member Arithmetic:

1Name ="Yehaoran"     #In to determine if ye is inside the name, return OK not return not2 #if "Ye" in Name:3 #print ("OK")4 #Else:5 #print ("not")6 7 if "ran"  not inchName:8     Print("OK")9 Else:Ten     Print(" not")#in does not determine if the RAN is not inside the name, return OK returns not
member Operations

Basic data types

1. Digital

int (integral type)

On a 32-bit machine, the number of integers is 32 bits and the value range is -2**31~2**31-1, which is -2147483648~2147483647
On a 64-bit system, the number of integers is 64 bits and the value range is -2**63~2**63-1, which is -9223372036854775808~9223372036854775807
1 #Numeric int2 #Python3, 1111111111111122333 numbers are used int3 #Python2, numbers are too large with a long small int4 5 #1. Convert a string to a number type View data type6 #a = "123"7 #Print (Type (a))8 #b = Int (a)9 #print (type (b))Ten #B = B + One #print (b) A  -  - #2. Convert to 10 binary in 16 binary format the #num = "a" - #v = int (num, base=16) - #Print (v) -  +  - #3, the current number of binary, at least with n-bit representation + ## a = 123 A ## r = a.bit_length () at ## Print (R)
several uses of int

Python basic data Type Day2

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.