74.5k views
2 votes
(image attached)

The program pictured asks a user to enter two values and the program adds them together.

Unfortunately it doesn't work l, identify the errors in the code. ​

(image attached) The program pictured asks a user to enter two values and the program-example-1
User Megkadams
by
4.8k points

1 Answer

8 votes

Answer:

The answer to this question is given below in the explanation section.

Step-by-step explanation:

In this given program there are two errors, first in line number 2 that stores a string value, not int. The second error is at line 6, a symbol "*" represents multiplication, not addition.

To solve these errors, in line #2, convert the input to an int variable value 1. To add the values of variables (value1 and value2), use the plus symbol "+" in the print statement at line #6.

The correct program is given below:

value1= int(input("Enter first number: "))

#get second number and store it into value2 variable.

value2= int(input("Enter second number: "))

#add the values store in variables (value1 and value2) and then print

print (value1 + value2)

User Samad Lotia
by
4.9k points