私はPythonを初めて使用し、random.randint
パートを100回繰り返すコードを作成する方法を知りたいです。
#head's or tail's
print("you filp a coin it lands on...")
import random
heads = 0
tails = 0
head_tail =random.randint(1, 2,)
if head_tail == 1:
print("\nThe coin landed on heads")
else:
print("\nThe coin landed on tails")
if head_tail == 1:
heads += 1
else:
tails += 1
flip = 0
while True :
flip +=1
if flip > 100:
break
print("""\nThe coin has been fliped 100 times
it landed on heads""", heads, """times and tails""", tails,
"""times""")
input("Press the enter key to exit")