Q. Find the errors in following code fragment:

 

c = input( "Enter your class")

print ("Last year you were in class") c-1

 

Answer =

Because c-1 code is out from the print statement and it is not an integer.

Correct program:

 

c = int(input( "Enter your class"))

print ("Last year you were in class", c-1 )

 

 

4 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post