Https://www.codecademy.com/courses/learn-python/lessons/python-2-loops/exercises/simple-errors

Hello fellow coders,

https://www.codecademy.com/courses/learn-python/lessons/python-2-loops/exercises/simple-errors
Starting from line 6 is my own attempt to code,above this is the solution
The difference I found is that my y and n didn’t have the single quotations
How are we supposed to know when to have these single quotations?

Thank you
Jagmeet

Single or double quotation marks denote strings-you should be familiar with strings from past lessons. raw_input turns the input from the console into a string, which means you conditions should check strings. If you don’t have any quotation marks, the program treats the object as a variable. In your case, it treats y as a variable, and as it is (variable y) is not defined, an error is appropriately raised.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.