Re: [Tutor] coin toss program without using the for/range loop

2007-01-04 Thread Christopher Arndt
Kent Johnson schrieb: > David wrote: >> print “Hit heads”+” “+str(heads)+” “+”times”+” “ + “hit tails” + “ >> “+str(100-heads)+” “ + “times” > > This sounds a lot like homework [...] An if you want to get extra marks for pythonicity ;-), read about string formatting here: http://www.python.org

Re: [Tutor] coin toss program without using the for/range loop

2007-01-04 Thread Luke Paireepinart
Kent Johnson wrote: > David wrote: > >> How to write the coin toss program without using the for/range loop program. >> >> Program flips a coin 100 times and then tells you the number of heads >> and tails. >> >> >> >> I can only solve it using the for/range loop >> >> >> >> Import random >

Re: [Tutor] coin toss program without using the for/range loop

2007-01-04 Thread Kent Johnson
David wrote: > How to write the coin toss program without using the for/range loop program. > > Program flips a coin 100 times and then tells you the number of heads > and tails. > > > > I can only solve it using the for/range loop > > > > Import random > > Heads=0 > > For 1 in rang

[Tutor] coin toss program without using the for/range loop

2007-01-04 Thread David
How to write the coin toss program without using the for/range loop program. Program flips a coin 100 times and then tells you the number of heads and tails. I can only solve it using the for/range loop Import random Heads=0 For 1 in range (100): Heads+=random.randrange(2) pri