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 )
Good
ReplyDelete: )
DeleteWrong
ReplyDeleteC is still string.
Use int() in input
Ok. I have corrected answer.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )