I need your help!
I have this problem that I can’t seem to figure out. Can you help? The
problem is listed below, and below it is my code that I have so far.
----------------------------------------------------------------------------
--------------------
Two hockey teams play eight times during the regular season. Team A wins
five times and Team B wins the other three times. They meet in the playoffs
in a best of seven series. Write a program that estimates the chances of
Team B winning the series. A sample run of the program might look like this:
.
Are team B's chances better in a 1 game "series", a 3 game series, a 5 game
series, or a 7 game series? What would team B's chances of winning a 51 game
series be?
----------------------------------------------------------------------------
-------------------
import random
SERIES = 1000
game = 0
series = 0
while series < SERIES:
teamA = random.randint (1,8)
teamB = random.randint (1,8)
teams = teamA + teamB
if random.randint(1,8) >= 5:
'Team A' = team
else:
'Team B' = team
game = game + 1
series = series + 1
print 'In %2d simulated series %2d won %2d ' % (SERIES,team,game)
print 'so I estimate there is a',(game / 10.00),'% chance they will win the
series.'
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.487 / Virus Database: 269.13.25/1018 - Release Date: 9/19/2007
3:59 PM
<<image001.gif>>
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
