name=''
eggs=0
pony=0.0
So why we write " while name:"
Instead of " while name=='': "
What are these Truthy and Falsey values?
And what are the rules for writing name:
Instead of name==''.
Amit_31
0
Newbie Poster
Recommended Answers
Jump to PostWhen you write
while expression: ...
python evaluates expression as a boolean value (which can only be True or False). The result is the same as using
bool(expression)
. Here are a few examples of usingbool()
>>> bool('') False >>> bool('hello') …
All 3 Replies
Gribouillis
1,391
Programming Explorer
Team Colleague
ddanbe
2,724
Professional Procrastinator
Featured Poster
Sean Francis
7
Newbie 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.