The Python Oracle

NameError: name 'true' is not defined

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

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

--

Chapters
00:00 Nameerror: Name 'True' Is Not Defined
00:32 Accepted Answer Score 93
00:51 Answer 2 Score 5
00:59 Answer 3 Score 3
01:07 Thank you

--

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

--

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