Record#
Today's practice is to troubleshoot errors. With modern error troubleshooting methods, I think it should be relatively simple, after all, there is the big killer chatgpt, hahaha!
- I don't know why there is a red underline error prompt on line 16 in replit, there is no actual problem with the execution. Could it be an emoji issue?
- Debugging went smoothly, except for some thought on if else elif. In the correct answer, print() is also fine, no need for "".
CODE#
print("100 Days of Code QUIZ")
print("") # Here it is speculated that printing a newline, printing nothing should work.
print("How many can you answer correctly?) # Missing quotes
ans1 = ("What language are we writing in?") # Missing Input
if ans1 == "python":
print("Correct")
else:
print("Nope🙈") # Missing quotes
ans2 = input("Which lesson number is this?") # Number, should be defined as Int
if(ans2>12):
print("We're not quite that far yet") # Indentation
else:
print("We've gone well past that!")
elif(ans2==12): # This elif should be after if, not after else.
print("That's right!")
Modified Code#
print("100 Days of Code QUIZ")
print("")
print("How many can you answer correctly?")
ans1 = input("What language are we writing in?")
if ans1 == "python":
print("Correct")
else:
print("Nope🙈")
ans2 = int(input("Which lesson number is this?"))
if(ans2>12):
print("We're not quite that far yet")
elif(ans2==12):
print("That's right!")
else:
print("We've gone well past that!")