Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ultra jump.py
- def axems(pink,black,red,yellow):
- import random
- times=0
- count=0
- num = 1000000 #number of samples
- while times<num:
- p=1 #pink targeted
- b=0
- r=0
- y=0
- count=count+1 #counting the first jump
- while p<pink or b<black or r<red or y<yellow:
- x = random.randint(1,4)
- if x==1:
- p=p+1
- elif x==2:
- b=b+1
- elif x==3:
- r=r+1
- elif x==4:
- y=y+1
- count = count + 1
- times=times+1
- print(count/num) #average
- def countdown(left,right,cd):
- import random
- times=0
- count=0
- num = 1000000 #number of samples
- while times<num:
- l=0
- r=0
- c=1
- count=count+1 #counting the first jump
- while c<cd or l<left or r<right:
- x = random.randint(1,3)
- if x==1:
- l=l+1
- elif x==2:
- r=r+1
- elif x==3:
- c=c+1
- count = count + 1
- times=times+1
- print(count/num) #average
- def gunyolk(gun,chief):
- import random
- times=0
- count=0
- num = 1000000 #number of samples
- while times<num:
- g=1
- c=0
- count=count+1 #counting the first jump
- while g<gun or c<chief:
- x = random.randint(1,2)
- if x==1:
- g=g+1
- elif x==2:
- c=c+1
- count = count + 1
- times=times+1
- print(count/num) #average
- def main():
- axems(1,1,1,1)
- axems(4,1,1,1)
- countdown(1,1,1)
- gunyolk(1,1)
- main()
Advertisement
Add Comment
Please, Sign In to add comment