The following Python program contains errors that will be detected by the IDLE syntax-checker. For each of these errors, state the number of the lines on which it occurs and how it should be corrected.
a.x = int(input(“Enter value for x”))
b.print(“The square of x is”x*x)
c.y = input(“Enter value for y”)
d.print(“ The product of x and y is “, x*y)
i.if x>y
ii.print(“the differences is “, x-y)
iii.else:
iv.print(“The difference is “, y-x
Error occurred on line# i.
The syntax for writing if condition is :
if (condition) :
//statement to be executed
Here in the line # i, we have , if x>y . This is wrong.
The correct statement should be :
if x>y:
The second error is at line # b.
The correct syntax is :
print("The square of x is ", x*x)
The third error is on line # iii. The syntax for print statement is print(“ statement to print ").
Therefore the statement is :
print(“The difference is “, y-x)
Please type a round bracket close on the print line.
If you have any questions comment down. PLEASE don't simply downvote and leave. If you are satisfied with answer, pleaseplease upvote thanks
Get Answers For Free
Most questions answered within 1 hours.