+ 1

A Programm that takes the sum of two integrs

I tried it with the following code can you explain what I did wrong x = int("2") y = int("8") sum = int(x) +int (y) print(sum)

4th Nov 2020, 6:26 PM
Thursday
Thursday - avatar
9 Respostas
+ 4
Okay Thursday but in line 3 you can write sum = x + y because you have already converted them into int.
4th Nov 2020, 6:36 PM
...
+ 3
a=int(input()) b=int(input()) print(a+b)
4th Nov 2020, 6:48 PM
Abhay
Abhay - avatar
+ 2
Your codes seems to be working fine. Do you want to take input from user?
4th Nov 2020, 6:29 PM
...
+ 1
Yes I think it would be good but it isn't really important I got the case from the python3 module basic concepts And the name of the task is Basic Calculator
4th Nov 2020, 6:32 PM
Thursday
Thursday - avatar
+ 1
Thanks a lot 🙏
4th Nov 2020, 6:53 PM
Thursday
Thursday - avatar
0
So I don't want that you think that this was my idea
4th Nov 2020, 6:33 PM
Thursday
Thursday - avatar
0
Yes it works in the regullary Python compiler but not in code sulution Simple Calculator
4th Nov 2020, 6:44 PM
Thursday
Thursday - avatar
0
Because in Testcase 2 is my input with 11 and the output 33 and the expected is 22 there is the same story but I could read from the Testcase 1 that it is supposed to be the sum of 3 and 6
4th Nov 2020, 6:46 PM
Thursday
Thursday - avatar
0
print(sum(x, y))
6th Nov 2020, 5:10 PM
AntorP
AntorP - avatar