- 1

Does python store values to add later ?

in first command i gave input one number and second command i gave input second number and then print add both numbers command but it doesnt take number two times and ask both number in one window instead and then doesnt add. doea python not store numbers ?

15th Jan 2017, 5:46 AM
ankit mundhara
ankit mundhara - avatar
6 Answers
+ 2
Post your code ^^
15th Jan 2017, 5:49 AM
visph
visph - avatar
+ 2
> x = input(enter first number) print(x) y = input(enter second number) print (y) print (float(x) + float(y)) The arguments inside the input function should be in quotes. input("enter a number")
15th Jan 2017, 6:05 AM
Don
Don - avatar
0
i am trying to do exact thing what you wrote as example, though i am asking number rather than giving it in program. like >> x = input(enter first number) print(x) y = input(enter second number) print (y) print (float(x) + float(y)) this is nt working .
15th Jan 2017, 6:03 AM
ankit mundhara
ankit mundhara - avatar
0
it shows error in last line print(float(x)+float(y)) even after the correction you suggested
15th Jan 2017, 6:09 AM
ankit mundhara
ankit mundhara - avatar
0
> x = input(enter first number) print(x) y = input(enter second number) print (y) print (float(x) + float(y)) If that's how your code still look... Change it to: x = input("enter first number") print(x) y = input("enter second number") print (y) print (float(x) + float(y)) The snippet you posted wasn't lined up and the redundant ">".
15th Jan 2017, 6:11 AM
Don
Don - avatar
0
x=float(input("enter a number: ")) print(x) y=float(input("enter another number: ")) print(y) print(x+y)
15th Jan 2017, 9:02 AM
Badmephisto
Badmephisto - avatar