Why doesn’t this work when i use decimals for x ?(Double for 31 days calculator) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why doesn’t this work when i use decimals for x ?(Double for 31 days calculator)

x = int(input()) z = int(x * (2**31)) y = 1000 if z > y: print("take the offer") else: print("take the 1000")

22nd Nov 2020, 2:15 AM
Jonathan Klein
Jonathan Klein - avatar
2 Answers
+ 2
What you mean "use decimals"? you mean take the number into a float variable? This is in Python right? had to ask cause you didn't tag a language. (Edit) Please delete the thread copy, you had accidentally posted this twice. https://www.sololearn.com/Discuss/2598550/?ref=app
22nd Nov 2020, 2:23 AM
Ipang
0
"int" means integers, so it only accepts integer values. You have to use "float" for decimal values.
22nd Nov 2020, 2:23 AM
Deep Kr. Ghosh
Deep Kr. Ghosh - avatar