Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- sim=100000
- total=0
- legal=0
- for i in range(sim):
- sesir=random.randint(1,3)
- kugla=random.randint(1,10)
- crvena=False
- if sesir==1 and kugla<4:
- crvena=True
- if sesir==2 and kugla<9:
- crvena=True
- if sesir==3 and kugla<5:
- crvena=True
- if crvena==True and sesir==3:
- legal+=1
- total+=1
- elif crvena==True:
- total+=1
- res=(legal/total)
- print(format(res,'.4f'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement