+ 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
5 Answers
+ 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..
+ 2
By casting it to a float()
+ 1
What do you mean in next line?
between, float(num) will return float type number...
+ 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
+ 1
Ya got it thank you