data type :
type() function - returns the type of the object
id() - returns the memory address of the variable object
- Numerical value :
1. Integer 'int'
2. Floating point number 'float' (inexact)
3. Operation Four arithmetic operations
2**2 (2 to the power of 2)-4
4**0.5 (4 square) -2
'//' represents the floor division return quotient 1/2=0.5 1//2=0 5//2=2
Floating point numbers and integer operations are converted to floating point numbers
The '/' operation is also a floating point number
3. Common operators:
a , b , c = 10 , 2 ,3
print('default floating-point quotient',a/4)
print('remainder',a%4)
print('Integer quotient', a//4)
print('10*2',10*2)
print('10**2',10**2)
- tuple()
A built-in data structure in python Tuples are write-protected and cannot be modified after creation
- tuples and lists are like tuples are () lists are []
- Advantages of tuples over lists: 1: tuples are faster than list operations 2: no modification is allowed, the data is safer
-delete
The element value in the tuple cannot be deleted, but we can use the del statement to delete the entire tuple
-change
Element values in tuples are not allowed to be modified, but tuples can be concatenated and combined
tup=(1,2,3)
tup2=('Hello','I'm good')
tup3=tup1+tup2
print tup3
-check
Tuples can use subscript indexing to access the values in the tuple as in the list
Convert string to tuple