Python - Variables and Dynamic Typing
What is wrong with this code?
data = 3.5
if type(data) == 'float':
print("Float detected")data = 3.5
if type(data) == 'float':
print("Float detected")type(data) to the string 'float', which is incorrect.float (without quotes) to compare types, not the string 'float'.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions