Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- class Coin:
- def __init__(self):
- self.tossing = int(input("= "))
- self.orel = 0
- self.reshka = 0
- def once(self):
- if random.randint(0, 1):
- return "Орёл"
- else:
- return "Решка" #1 орел \\\ 0 решка
- def multiple_times(self):
- for i in range(self.tossing):
- if random.randint(0, 1) == 1: #если орел
- self.orel += 1
- else:
- self.reshka += 1
- return ("Орёл : " + str(self.orel/self.tossing),"Решка : " + str(self.reshka/self.tossing))
- c1 = Coin()
- print(c1.once())
- print(c1.multiple_times())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement