Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import*
- global program, programs
- print("1. Program that displays number of checks to get desired number of shinies.")
- print("2. Program that displays number of shinies that are encountered in desired number of checks.")
- program=int(input("Which program do you want to use?: "))
- if program==1:
- programs=int(input("Enter the amount of times you want to run this program: "))
- print(" ")
- for counter in range(0,programs):
- global value, shiny, odds, number, pokemon, average
- shiny=0
- pokemon=0
- odds=int(input("Enter odds of shiny: "))
- number=int(input("Enter the number of shinies you want: "))
- while True:
- value=randint(0,odds)
- if value>1:
- pokemon=pokemon+1
- elif value==1:
- shiny=shiny+1
- if shiny==number:
- break
- average=pokemon/number
- print("You encountered",pokemon,"pokemon to get",number,"shinies.")
- print("You averaged",round(average,2),"checks per shiny.")
- print(" ")
- elif program==2:
- programs=int(input("Enter the amount of times you want to run this program: "))
- print(" ")
- for counter in range(0,programs):
- global shiny2, value2, odds2, checks, average2
- shiny2=0
- odds2=int(input("Enter odds of shiny: "))
- checks=int(input("Enter the number of pokemon that you encountered: "))
- for counter in range(0,checks):
- value2=randint(1,odds2)
- if value2==1:
- shiny2=shiny2+1
- if shiny2>1:
- average2=checks/shiny2
- print("You encountered",shiny2,"shinies.")
- print("Your average was",average2,"checks per shiny.")
- print(" ")
- elif shiny2==1:
- average2=checks/shiny2
- print("You encountered",shiny2,"shiny.")
- print("Your average was",average2,"checks per shiny.")
- print(" ")
- else:
- print("You encountered",shiny2,"shinies.")
- print(" ")
- else:
- print("Enter a valid answer. Restart program to carry on.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement