Type conversion seems wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Type conversion seems wrong?

I text the sample: float(input(“40”)) + float(input(“2”)) my python displays 40, which is not the correct answer? (sample answer is 42) my python version is 3.7 32bit, is that my python need to update?

7th Apr 2020, 3:28 AM
Arvonce
3 Answers
+ 3
...it just takes the input by initally displaying the 40.... Try pressing any number and enter.......then 2 will be also displayed in the next line....give another input...and then press enter ..those numbers will be added float(input("enter a num"))+float(input("enter a num"))...try giving like this and input the value
7th Apr 2020, 3:44 AM
Prime-z
+ 1
thank you guys
7th Apr 2020, 4:11 AM
Arvonce
0
Write the code on the Playground and show it to us.
7th Apr 2020, 3:39 AM
Fernando Pozzetti
Fernando Pozzetti - avatar