0

Why doesn't this output a sum input1=2 input2=8 print(input1+input2)

8th Mar 2022, 6:20 AM
Rhys Law
Rhys Law - avatar
6 Respuestas
+ 1
print(int(input())+int(input())) Are you trying to add two integers?? (You can use the above code) // For to add them as strings you can do: print(input()+input())
8th Mar 2022, 6:42 AM
NEZ
NEZ - avatar
+ 1
That code runs as i tested it. The code doesn't read user input, so no type conversion was necessary. You just created two integer variable and print the sum of the two, no problem at all.
8th Mar 2022, 7:00 AM
Ipang
0
Really? show your code?
8th Mar 2022, 6:40 AM
Ipang
0
input1=2 input2=8 print(input1+input2)
8th Mar 2022, 6:43 AM
Rhys Law
Rhys Law - avatar
0
Thanks
8th Mar 2022, 6:43 AM
Rhys Law
Rhys Law - avatar
0
nb1 = int(input()) nb2 = int(input()) print(nb1+nb2)
10th Mar 2022, 4:17 AM
Pasot
Pasot - avatar