Of course that isn't very useful code. I thought it might be a useful
quick test for someone learning how while loops treat different
values.
On Tue, May 20, 2014 at 2:46 PM, Danny Yoo wrote:
> On Tue, May 20, 2014 at 11:44 AM, C Smith
> wrote:
>> You can test out a condition like this in IDLE
On Tue, May 20, 2014 at 11:44 AM, C Smith wrote:
> You can test out a condition like this in IDLE like so:
> while 6:
> print "yes its true"
> break
>
>
> while 0:
> print "yes its true"
> break
>
>
> while -1:
> print "yes its true"
> break
>
>
> emptyList = []
> while emt
You can test out a condition like this in IDLE like so:
while 6:
print "yes its true"
break
while 0:
print "yes its true"
break
while -1:
print "yes its true"
break
emptyList = []
while emtpyList:
print "yes its true"
break
This way you don't have to deal with
On Tue, May 20, 2014 at 1:25 AM, Ian D wrote:
> I was reading a tutorial that had these examples in it:
>
>
while False:
> print("False is the new True.")
>
>
while 6:
> print("Which numbers are True?")
>
>
> while -1:
> print("Which numbers are True?")
>
>
> while 0:
> print("Wh
On Tue, May 20, 2014 at 08:25:48AM +, Ian D wrote:
> I was reading a tutorial that had these examples in it:
>
> >>> while False:
>
> print("False is the new True.")
[... snip examples ...]
> I was wondering if the gist of a while statement could be explained in
> the context of these
On 20May2014 08:25, Ian D wrote:
I was reading a tutorial that had these examples in it:
while False:
print("False is the new True.")
while 6:
print("Which numbers are True?")
while -1:
print("Which numbers are True?")
while 0:
print("Which numbers are True?")
Unfortunately the auth
Hi,
6, -1 or 0 are not bools (True or False):
>>> 6 is True
False
>>> 0 is False
False
If you had to design a language and want to think about using numbers
in a logical context you could do at least two things:
1) convert the number to bool, ie define a set of rules to assign to
each number a lo
Or should I have said While False is True, which is never True, because False
is False not True
> From: dux...@hotmail.com
> To: tutor@python.org
> Date: Tue, 20 May 2014 08:25:48 +
> Subject: [Tutor] While truth
>
> I was reading a
I was reading a tutorial that had these examples in it:
>>> while False:
print("False is the new True.")
>>> while 6:
print("Which numbers are True?")
while -1:
print("Which numbers are True?")
while 0:
print("Which numbers are True?")
Unfortunately the author never explained