Write a program to take two integers as input and output their sum. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Write a program to take two integers as input and output their sum.

a = int(input()) b = int(input()) print(a+b) What's wrong with my code The error is File "/usercode/file0.py", line 2 a=int (input()) IndentationError: unexpected indent

1st Nov 2021, 5:51 AM
Tejas Jadhav
Tejas Jadhav - avatar
4 Answers
+ 7
If your code is exactly as below, a = int(input()) b = int(input()) print(a+b) It doesn't have any errors. I guess you're adding some spaces or tabs by mistake. Recheck it. All the best =)
1st Nov 2021, 6:13 AM
Rishi
Rishi - avatar
+ 6
Check accurately if all lines begin at first col of line. before first line delete everything.
1st Nov 2021, 7:41 AM
Oma Falk
Oma Falk - avatar
+ 5
Hi Tejas! It seems your code is working fine. Can you tell us what kind of error message you're receiving?
1st Nov 2021, 5:59 AM
Python Learner
Python Learner - avatar
+ 1
Probably you’re not writing completely from the left side of the screen. Maybe you’re writing all with a space or a tab in front of every line
2nd Nov 2021, 6:51 AM
Veronica Spialtini
Veronica Spialtini - avatar