Write a program to take two integers as input and output their sum. Sample Input: 2, 8 Sample Output: 10 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a program to take two integers as input and output their sum. Sample Input: 2, 8 Sample Output: 10

Please help me out with this

27th Dec 2020, 10:20 PM
NDUBUISI PRINCE CHIMEREMEZE
9 Answers
+ 4
Hey, your code is good, the only problem is that x and y are treated like strings here cos input() returns the text that the user entered. So remember, if you wanna treat them like ints (the data type used for entire numbers) you can use int() function and give input() as an argument. This will return the integrer version of the input. This should be the code: # your code goes here x = int(input()) y = int(input()) print (x+y) Hope this can help you!! :)
28th Dec 2020, 3:39 PM
Paula Campbell
Paula Campbell - avatar
+ 2
Bro I have noticed, you are still learning python. Not bad but don't just rush though it, take your time and understand. Your problem is very simple but try coding it yourself in the code playground and see, if you have a problem then you can link your code here for help
27th Dec 2020, 11:28 PM
Rawley
Rawley - avatar
+ 1
Learn to use google or even learn some basic maths and programming ,
27th Dec 2020, 10:23 PM
Abhay
Abhay - avatar
+ 1
Yep it sure does ur d best
29th Dec 2020, 2:17 PM
NDUBUISI PRINCE CHIMEREMEZE
0
NDUBUISI PRINCE CHIMEREMEZE, show your attempt plz.
27th Dec 2020, 10:24 PM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
0
Kk
27th Dec 2020, 10:25 PM
NDUBUISI PRINCE CHIMEREMEZE
0
See my attempt here
27th Dec 2020, 10:26 PM
NDUBUISI PRINCE CHIMEREMEZE
0
input(int())
27th Dec 2020, 10:27 PM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
- 1
# your code goes here x = input() y = input() print (x+y)
27th Dec 2020, 10:26 PM
NDUBUISI PRINCE CHIMEREMEZE