Float Assignment
Float Assignment
print(10.20 and 20.30) #both are true and second value taken
>Output is 20.3
Q. What is the output of expression inside print statement. Cross check
before running the program.
a = 10.20
b - 1 0.20
print(a is b) #True or False? True 10.20<256
print(a is not b) #True or False? False
Why the Id of float values are different when the same value is
assigned to two different variables
ex: a = 10.5 b=10.5. but id will be same if I assign the variable
having float i.e. a=c then both a and c's Id are same
print('2.7' i
n ' Python2.7.8') #True
print(10.20 i n [10,10.20,10+20j,'Python']) #True
print(10.20 in (10,10.20,10+20j,'Python')) # True
print(20.30 in {1,20.30,30+40j}) # True
print(2.3 in {1:100, 2.3:200, 30+40j:300}) # True
print(10 in range(20)) # True