0

Why doesn't this code work?

user=float(input("")) user2=float(input("")) def add(x,y): return x+y print(add(user,user2)) #I defined add and I'm trying to add the two user input's but it keeps saying "line 1 Value error: could not convert string to float" And it sucks because it messed up my entire calculator that was literally JUST working.

8th Sep 2016, 7:43 PM
Darth Vador
Darth Vador - avatar
3 Respuestas
+ 1
I just checked your code, and it works. What are you inputting? Maybe you are using , (comma) instead of . (dot) for floating numbers?
8th Sep 2016, 8:59 PM
Zen
Zen - avatar
+ 1
what did you input?
8th Sep 2016, 10:23 PM
Lub Pig
Lub Pig - avatar
0
I must've inputed something weird...Several times...it's working fine now. Thank you guys.
9th Sep 2016, 3:36 AM
Darth Vador
Darth Vador - avatar