Hello new to coding and I wanted to ask why doesn't my code become a float when I run it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Hello new to coding and I wanted to ask why doesn't my code become a float when I run it

https://code.sololearn.com/c1GDi6uOkaCx/?ref=app

12th Nov 2021, 2:40 PM
Keith
2 Answers
+ 3
because you're multiplying full numbers. That will never result in a float. if you want to force it to be a float: print(float(2**2)) Keith no worries. P.S. regular division between whole numbers always results in a float (unless forced with typecasting like above)
12th Nov 2021, 2:40 PM
Slick
Slick - avatar
+ 2
Thanks Slick
12th Nov 2021, 2:43 PM
Keith