Advertisement
Guest User

Pokemon

a guest
Feb 24th, 2020
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. from random import*
  2. global program, programs
  3. print("1. Program that displays number of checks to get desired number of shinies.")
  4. print("2. Program that displays number of shinies that are encountered in desired number of checks.")
  5. program=int(input("Which program do you want to use?: "))
  6. if program==1:
  7. programs=int(input("Enter the amount of times you want to run this program: "))
  8. print(" ")
  9. for counter in range(0,programs):
  10. global value, shiny, odds, number, pokemon, average
  11. shiny=0
  12. pokemon=0
  13. odds=int(input("Enter odds of shiny: "))
  14. number=int(input("Enter the number of shinies you want: "))
  15. while True:
  16. value=randint(0,odds)
  17. if value>1:
  18. pokemon=pokemon+1
  19. elif value==1:
  20. shiny=shiny+1
  21. if shiny==number:
  22. break
  23. average=pokemon/number
  24. print("You encountered",pokemon,"pokemon to get",number,"shinies.")
  25. print("You averaged",round(average,2),"checks per shiny.")
  26. print(" ")
  27.  
  28. elif program==2:
  29. programs=int(input("Enter the amount of times you want to run this program: "))
  30. print(" ")
  31. for counter in range(0,programs):
  32. global shiny2, value2, odds2, checks, average2
  33. shiny2=0
  34. odds2=int(input("Enter odds of shiny: "))
  35. checks=int(input("Enter the number of pokemon that you encountered: "))
  36. for counter in range(0,checks):
  37. value2=randint(1,odds2)
  38. if value2==1:
  39. shiny2=shiny2+1
  40. if shiny2>1:
  41. average2=checks/shiny2
  42. print("You encountered",shiny2,"shinies.")
  43. print("Your average was",average2,"checks per shiny.")
  44. print(" ")
  45.  
  46. elif shiny2==1:
  47. average2=checks/shiny2
  48. print("You encountered",shiny2,"shiny.")
  49. print("Your average was",average2,"checks per shiny.")
  50. print(" ")
  51. else:
  52. print("You encountered",shiny2,"shinies.")
  53. print(" ")
  54.  
  55. else:
  56. print("Enter a valid answer. Restart program to carry on.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement