+ 1

I Get Error When I Run This Code...Why?

float(input("Enter a number: ")) + float(input("Enter another number: ")) Enter a number: 40 Enter another number: 2

15th Apr 2019, 6:29 AM
Abdul Sultan
Abdul Sultan - avatar
7 Respostas
+ 9
Abdul Sultan Yes its not giving any errors just use print statement to print the sum of numbers. print(float(input("Enter a number: ")) + float(input("Enter another number: ")))
15th Apr 2019, 7:18 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 9
Abdul Sultan if you are doing that in python then try this way. a=float(input("Enter a number: ")) b=float(input("Enter another number: ")) c=a+b print(c)
15th Apr 2019, 6:46 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 1
Thank you. I didn't notice the print statement was omitted GAWEN STEASY
15th Apr 2019, 7:24 AM
Abdul Sultan
Abdul Sultan - avatar
0
GAWEN STEASY I actually expected no error because that code is from a python lesson under #type-conversion.
15th Apr 2019, 7:00 AM
Abdul Sultan
Abdul Sultan - avatar
0
Ok
18th Apr 2019, 3:19 PM
Habib Conor
0
Yu oo
18th Apr 2019, 3:20 PM
Habib Conor
0
Bro it is simple when u input u type (3 4) So this input is taken as a string So u must input (3 4) i.e input a no and press enter or leave a line then input 2nd no
13th Oct 2019, 1:17 PM
Udith S M
Udith S M - avatar