Can someone tell me what is the difference between while(1) and while (true) in python?
techyworld 0 Junior Poster in Training
Recommended Answers
Jump to PostLatter causes uninitialized variable error if true variable is not defined. Python is case sensitive.
Jump to PostPlease use True (it is capitalized) ...
# initialize count count = 0 # you could use 1 instead of True, but True is clearer while True: print(count) count += 1 # exit condition needed to stop endless loop if count > 8: break '''result ... 0 …
All 7 Replies
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
techyworld 0 Junior Poster in Training
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster
techyworld 0 Junior Poster in Training
TrustyTony 888 ex-Moderator Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.