conditional expression sought
wes weston
wweston at att.net
Thu Jan 29 22:02:26 EST 2004
Elaine,
The last code line:
print "I would have liked this to be B[2] = ",B[2]
prints the value of B[2]; the value you don't want.
I think what you meant was that you want B[2] to be
0.0 not false. bool(0.0) does equal false.
---------------------------------------------------
The code:
A.append(bool(randint(0,1)))
will always yield an A of [true,true,true]
---------------------------------------------------
I didn't know this about python, and I'm not sure I
like it:
wes at linux:~/amy> python
>>> print 1.1 and 2.2
2.2
>>> print 2.2 and 1.1
1.1
>>> print (1.1 and 2.2)
2.2
The order is important. To me, it should be printing true
and not either number or the last number.
More information about the Python-list
mailing list