+ 1
25th Aug 2025, 7:32 AM
CodeVortex 🧙
CodeVortex 🧙 - avatar
4 Respostas
+ 2
@Ikechika Dickson You had problems with your indention and some syntax errors and also some incomplete exception handling... I have edited your code to the bare minimum and simple to understand, please note the indention. Now its working perfectly. Below is the code. #======== START OF CODE ======== first_number=int(input("Please enter first number: ")) print(first_number) second_number=int(input("Please enter second number: ")) print(second_number) operator = input("Choose an operation (+) or (-):") if(operator[0]=="+"): result = first_number + second_number elif(operator[0]=="-"): result = first_number - second_number print(operator[0]) print("Your answer is" , result) #======== END OF CODE ======== Let me know if you want me to add exception handling
25th Aug 2025, 8:12 AM
mashtullah
mashtullah - avatar
0
The error message should be pretty clear - unexpected indent. Python uses indentation to distinguish structeres (e.g. where if starts and ends). Your indents are all messed up.
25th Aug 2025, 7:59 AM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
0
Can you code one and show me đŸ„Č
25th Aug 2025, 8:00 AM
CodeVortex 🧙
CodeVortex 🧙 - avatar
0
mashtullah Please explain better
25th Aug 2025, 8:25 AM
CodeVortex 🧙
CodeVortex 🧙 - avatar