+ 1

How to convert am integer into float in next line

This is an simple calculator I want to input the number as an integer but after some line it be printed as a float number how to do it? https://code.sololearn.com/cfzd3LRDKpAg/?ref=app

1st Jun 2022, 3:17 PM
Jude Maria Bevan
Jude Maria Bevan - avatar
5 Respostas
+ 3
Instead of converting to int in line 20,22 , convert input into float as float( input() ) . Then you can work with int as well as float. As already told, float(num1) will return float type num1 value..
1st Jun 2022, 3:31 PM
Jayakrishna 🇮🇳
+ 2
By casting it to a float()
1st Jun 2022, 3:20 PM
Lisa
Lisa - avatar
+ 1
What do you mean in next line? between, float(num) will return float type number...
1st Jun 2022, 3:22 PM
Jayakrishna 🇮🇳
+ 1
In line number 20 and 22 the input numbers are integer but in line number 25 I need to display num1 and num2 as float Ex: 7 8 7.0+8.0= 15.0
1st Jun 2022, 3:25 PM
Jude Maria Bevan
Jude Maria Bevan - avatar
+ 1
Ya got it thank you
1st Jun 2022, 3:33 PM
Jude Maria Bevan
Jude Maria Bevan - avatar