x = input("Guess a number: ") == 7 print(x) x = input("Guess a number: ") == '7' # compare string and string print(x) x = int(input("Guess a number: ")) == 7 # compare int and int print(x) # what data type does the input() function return? # how does == work? # when should you do casting? # --------------------------------- # y = 12 z = y ** 2 print(z, type(z)) z = y ** 2.0 print(z, type(z)) z = float(y) print(z, type(z)) z = str(y) print(z, type(z)) z = y / 5 # natural division, always result in float print(z, type(z)) z = y // 5 # integer division print(z, type(z)) z = y % 5 # remainder print(z, type(z)) z = 2.0 print('z' * 3, z * 3, '2.0' * 3, str(z) * 3) print((float('2.0') * 3) * 3) print(int(12.5)) print(int('12')) print(int('12.5')) # What is wrong? print(int(float('12.5'))) # int(...string...) works if string looks like int # float(...string...) works if string looks like float # write code to get a number from a user # and evaluate and display whether the given number # is odd or even. # That is, print True if is it even # other print False