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

Christopher Arndt chris.arndt at web.de
Fri Jan 5 01:50:36 CET 2007


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/doc/current/lib/typesseq-strings.html

Chris


More information about the Tutor mailing list