[Tutor] Creating Adventure Games Python Port - Chapter 2
Will Shattuck
willshattuck at gmail.com
Mon Oct 2 01:38:07 CEST 2006
Hi all,
I thought that it would be a great idea to learn Python while porting
the BASIC code from this book. So I printed all the pages, have them
"bound" by a big binder clip, and read through the first bit.
In Chapter 2 there is a type of "Choose Your Own Adventure" type
section. Since I didn't have two quarters, but I did have my laptop,
I put together a quick "pycoin.py" program to "flip" the coins. Since
I am an extreme beginner I thought I would submit it for review. Here
you go:
=============================
import random
coin1 = 0
coin2 = 0
coin1 = random.randint(1, 10)
coin2 = random.randint(1, 10)
if coin1 <= 5:
print "Coin1 is Heads"
else:
print "Coin1 is Tails"
if coin2 <= 5:
print "Coin2 is Heads"
else:
print "Coin2 is Tails"
=============================
--
Will Shattuck ( willshattuck.at.gmail.com )
Home Page: http://www.thewholeclan.com/will
When you get to your wit's end, you'll find God lives there.
More information about the Tutor
mailing list