print(float(input("Enter a number: ")) + float(input("Enter another number: "))) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

print(float(input("Enter a number: ")) + float(input("Enter another number: ")))

I couldn't get how to enter details for code alert box displayed on screen the 2 different inputs

1st Jul 2017, 5:07 PM
Jay Chheda
Jay Chheda - avatar
7 Answers
+ 3
thanks both of you
1st Jul 2017, 5:26 PM
Jay Chheda
Jay Chheda - avatar
+ 2
try instead: a = float (input ("Enter a number: ")) b = float (input ("Enter another number: ")) print (a + b) It's better to sort out your variables line by line, and THEN manipulating them. Not only for readability, but it helps you not to get lost in your own code. Shoving everything into the same line just makes it harder on yourself.
1st Jul 2017, 5:12 PM
Sapphire
+ 2
how to enter the input for program for example 2 4 or '2' '3'
1st Jul 2017, 5:16 PM
Jay Chheda
Jay Chheda - avatar
+ 2
I'm not getting it
1st Jul 2017, 5:16 PM
Jay Chheda
Jay Chheda - avatar
+ 2
will program not work properly on code playground
1st Jul 2017, 5:21 PM
Jay Chheda
Jay Chheda - avatar
+ 1
The input function you used is how you retrieve data from the user. But keep in mind, on the code playground here on sololearn, you enter your inputs at the start only, since it is run server side.
1st Jul 2017, 5:19 PM
Sapphire
0
In the playground when it asks for your input, enter the first number (or other type of input) press return/enter then enter the second number (repeat for however many inputs the program takes), then once all your inputs are entered click/tap submit.
1st Jul 2017, 5:23 PM
ChaoticDawg
ChaoticDawg - avatar