+ 4

Is this code having any errors??

number_1 = int(input("Enter number 1: ")) number_2 = int(input("Enter number 2: ")) sum = number_1 + number_2 print(sum)

17th Nov 2023, 6:20 AM
Chathurika Dewmini
Chathurika Dewmini - avatar
8 ответов
+ 10
Chikkii , why asking this question? > you can use this code and run it in playground by yourself (*). if you have any doubt or problem just describe it here. (*) keep in mind that sololearn playground is not working interactively for taking input. the input prompting will appear after code was executed. input in this case has to be done in the popup window, using a new line for each call of the input() function.
17th Nov 2023, 7:14 AM
Lothar
Lothar - avatar
+ 3
It does not have error if the user enter integer but the user can enter character that is problem because string can't convert to int using int function
17th Nov 2023, 2:17 PM
CodeWarrior
CodeWarrior - avatar
+ 2
it's work, but you may not give the 2 input enter the first number enter the second number and click on submit
17th Nov 2023, 7:19 AM
Mohamed Beder Oumar
Mohamed Beder Oumar - avatar
+ 1
There is no error
17th Nov 2023, 7:12 AM
Mohamed Beder Oumar
Mohamed Beder Oumar - avatar
+ 1
No,it is right✅️
18th Nov 2023, 6:46 PM
Matronics
Matronics - avatar
+ 1
Run it to see?
19th Nov 2023, 2:54 AM
Jorge Alberto Rios Mejia
0
No error, you can copy it and paste it in programiz python compiler website.
18th Nov 2023, 1:55 PM
Sanjoy Singha
Sanjoy Singha - avatar
0
Yes !. It is absolutely correct it is a basic program in python ,do more programs like this . Try using other data types and mixed data types also then you can improve better ☺️
18th Nov 2023, 5:19 PM
Rajesh