CoCalc Public Fileswheel_game.ipynbOpen with one click!
Authors: Sharalee Jones , Johann Thiel, C Y, sophie j
Views : 67
Compute Environment: Ubuntu 20.04 (Default)
In [1]:
import random
In [2]:
listt=[] stat=0 def spin(): if total < 100 and total >85: return 1 else: return 0 #print(num1,num2,total) for i in range(1000): num1= random.randrange(0,101,5) num2= random.randrange (0,101,5) total=num1+num2 listt.append(spin()) for u in listt: stat=stat+u length=len(listt) #print(listt,stat,length) print(stat/length)
[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 11 100 0.11
In [ ]: