[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python Probability

On Tue, 11 Sep 2018 20:54:23 +0200 (CEST), Bat erdene endzis wrote:
> def dice():
>     attacker_dice=[random.randint(1,6) for _ in range(3)]
>     defender_dice=[random.randint(1,6) for _ in range(2)]
>     a=max(attacker_dice)
>     b=max(defender_dice)
>     for i in range(1000):
>         F=0
>         S=0
>         T=0
>         if a>b:
>             F+=1
>         if a==b:
>             S+=1
>         else:
>             T+=1

Do you really want to set F, S, and T back to zero on each pass through
that loop?

Presumably you want to remove a from attacker_dice and b from
defender_dicce and repeat the comparison with the new maxes.

To email me, substitute nowhere->runbox, invalid->com.