Can any one help with solving this program it just doesnt take probability of the second team

Peter Otten __peter__ at web.de
Thu Oct 26 03:18:17 EDT 2006


Arun Nair wrote:

> ''' Can anyone help me with this program it just takes probability of
> the first team and runs the program doesnt takes the probability of the
> second team even though specified'''

> def simGame(probA, probB):
>     scoreA = 0
>     scoreB = 0
>     serving = "A"
>     while not gameOver(scoreA, scoreB):
>         if serving == "A":
>             if random() < probA:
>                 scoreA = scoreA + 1
>             else:
>                 serving == "B"

Hint: this is not an assignment.

>         else:
>             if random() < probB:
>                 scoreB = scoreB + 1
>             else:
>                 serving == "A"

Same thing.

>     return scoreA, scoreB

Peter




More information about the Python-list mailing list