The Python Oracle

NameError: name 'true' is not defined

This video explains
NameError: name 'true' is not defined

--

Become part of the top 3% of the developers by applying to Toptal
https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Secret Catacombs

--

Chapters
00:00 Question
00:44 Accepted answer (Score 83)
01:09 Answer 2 (Score 5)
01:24 Answer 3 (Score 3)
01:38 Thank you

--

Full question
https://stackoverflow.com/questions/3009...

Accepted answer links:
[True]: https://docs.python.org/3/library/consta...
[False]: https://docs.python.org/3/library/consta...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #gpio

#avk47



ACCEPTED ANSWER

Score 93


Python’s boolean constants are capitalized: True and False with upper case T and F respectively.

The lower-case variants are just valid free names for variables, so you could use them for whatever you want, e.g. true = False (not recommended ;P).




ANSWER 2

Score 5


You haven't defined a variable true. Maybe you meant the built-in boolean value True?




ANSWER 3

Score 3


while True:

# but seems like inifite loop