from decimal import Decimal
a = Decimal('1.1')
print(type(a),a)
b = Decimal('0.5')
c = Decimal('0.4')
print(b-c)
d = Decimal('0.1')
print(0.1 * 3)
print(d * 3)
_1 = 2 #comment
y = 2
print(id(y))
y = y + 12
print(_1,y)
print(id(_1),id(y))
x = 1
print(type(x), id(x))
x = float(x)
print(type(x), id(x))
x = True
print(type(x), id(x))
print(1 == True)
print(0 != False)
print(1/3 + 1/3 + 1/3)
print(1, 5j)
name = ['John','Amy', 'Peter', [True, 12, 55, ["hello", "world", 3.4, '1'], "Dave"]]
print(name)
print(name[0], id(name[0]), name[1], id(name[1]), name[2], id(name[2]))
age = [30,12,60]
name[1] = age
print(name, name[1], name[1][1])
print(name[3][3][3])
a = 1
print(id(a))
a = 10
print(id(a))
x = ["john", "ann"]
print(id(x),x)
x[0] = ["john", "ann", "peter"]
print(id(x),x)
y = x # x address insert to y. Therefore, y addess equal to x address
print(id(y),y)
x = []
print(id(x))
# The id of x (Line 47) is different with x (Line 49)
x = ["john", "ann", "peter"]
print(id(x))
x = ["john", "ann", "peter"]
print(id(x))
b = "abcdefghijklmnopq"
c = "abcdefghijklmnopq"
print(id(b))
print(id(c))
a = {1,2,3,4,5,6,1,1,2,2,3,4,2,3,1}
print(a)
a = {'apple',1,"dog",2,3,"apple",4,5,6,"dog",1,1,2,2,3,4,2,3,1}
print(a) # The result is random.
# frozenset -> don't let anyone edit the list. if a(frozenset)|b, result is frozenset. if a(normalset)|b(frozenset), result is normalset.
#a = frozenset({'apple',1,"dog",2,3,"apple",4,5,6,"dog",1,1,2,2,3,4,2,3,1})
x = 1
a = {'apple',1,"dog",2,3,"apple",4,5,6,"dog",1,1,2,2,3,4,2,3,1,print(x),} #If python see (), it will handle () firstly. In this case, it will print '1' firstly.
b = frozenset({'cat',7,8,1,2})
union = a | b
print("Union:")
print(union)
intersection = a & b
print("intersection:")
print(intersection)
intersection.remove(1)
print(intersection)
union.remove(1)
print(union)