Practice makes Perfect


So I was having problem with this section, my codes seemed to make sense but I kept getting error messages and I looked through the Q&A Forums and figured out what was wrong with my coding. Turns out it was a very simple fix and I feel really stupid. Anyway I kept getting a message that said "False came out as 'False' instead of False" which made no sense to me then i looked at my line of code and realized that it was in quotation marks. I'm used to including the quotations mark and when i started learning coding with QB64 and applied it to Visual Basics I always included the quotations marks around True and False statements. So if you get an error message like the one below just make sure your False statement is not in quotes but if somebody would explain to me why quotation marks are not necessary I would appreciate it,


you enclosed the False in quotes. remove the quotes around it


Good day @user_beck ,

Many thanks for sharing this bit with us. This way we all learn even more. In reaction to your invitation for some explanation of why False gets no quotation marks in Python, my 50cent:

True, False, None, as, break, and some other words are reserved words, or keywords of the language and as such, they are to be used 'exactly' as they are spelt in the Python documentation (where True, False and all the keywords are spelt without quotation marks to convey the information the language attributes to each of them).

Happy learning!


Right, figured that out after doing some digging but I just wanted to know why the quotes are not necessary and why in some cases you need to include it and @khoel answered it but I appreciate it nevertheless.


That's because 'True' is a protected namespace ( a reserved keyword that comes with the language) and its data type is boolean.

When codeacademy tests your code they look for that reserved keyword.Now what you wrote (i.e. surrounding it in quotes) is different because "False" is a string data type and not Boolean .

So when their test function run it expects to see a Boolean but then your code will give a string which will cause the test function to flag it as wrong

Hope this helps :smile:


aha, yes it definitely makes a lot more sense. Thank you. One last question, lets say I was coding on the software python and not here, would I exclude the quotation marks around the True and False statements? I know you said that True and False statements are a boolean data type but I just want to make sure.


Yes exclude the quotation mark if your intention is to return a boolean value :smiley: :smile: