Code not working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Code not working

I have completed every course in python3 but now I have to to the challenges, I just want to get it over with, but horrible python can't even do simple math with variables, can't even do 3 lines of code, it just smooshes them together, it doesn't add If this keeps up, I'm going to quit python. num1 = input("choose number 1") num2 = input("choose number 2") print(num1 + num2)

20th Oct 2020, 12:12 PM
Super Toast
Super Toast - avatar
2 Answers
+ 6
a, b = input("Sum is: ").split() print(a+b)
20th Oct 2020, 12:21 PM
Aditya
Aditya - avatar
+ 3
return type of input() function is string ,cast the result to integer int(input()) to perform addition
20th Oct 2020, 12:17 PM
Abhay
Abhay - avatar