Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random as r
- class Dodewuerfel(object):
- def __init__(self):
- self.augenZahl = ()
- def würfeln(self):
- gewuerfelteZahl = r.randint(1,12)
- self.augenZahl = (gewuerfelteZahl)
- def einSpiel():
- counter = 0
- gesamt = 0
- würfel = Dodewuerfel()
- while gesamt < 21:
- counter = counter+1
- würfel.würfeln()
- gesamt = gesamt + würfel.augenZahl
- return counter
- würfel=Dodewuerfel()
- anzahl = 10
- anzahlZumRechnen = anzahl
- counter = 0
- counterGesamt = 0
- while anzahl > 0:
- counter = einSpiel()
- counterGesamt = counterGesamt + counter
- anzahl = anzahl - 1
- schnitt = counterGesamt / anzahlZumRechnen
- print(schnitt)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement