Skip to content

Instantly share code, notes, and snippets.

@LordShedy
Created May 10, 2020 13:34
Show Gist options
  • Save LordShedy/69b62d48bb713df4cf35c93c6036d0d7 to your computer and use it in GitHub Desktop.
Save LordShedy/69b62d48bb713df4cf35c93c6036d0d7 to your computer and use it in GitHub Desktop.
A Python script for getting Pokémon IV percentage from its appraisal.
#!/usr/bin/env python3
from enum import Enum
class Rates(Enum):
A = 15
B = 14
C = 13
D = 12
E = 11
F = 10
G = 9
H = 8
I = 7
J = 6
K = 5
L = 4
M = 3
N = 2
O = 1
P = 0
class color:
YELLOW = '\033[93m'
RED = '\033[91m'
ORANGE = '\033[33m'
END = '\033[0m'
def main():
bar = "[{} O {}| N |{} M {}| L |{} K {}] [{} J {}| I |{} H {}| G |{} F {}] [{} E {}| D |{} C {}| B |{} A {}]"
print(bar.format(color.ORANGE, color.END, color.YELLOW, color.END, color.ORANGE, color.END, color.ORANGE, color.END, color.YELLOW, color.END, color.ORANGE, color.END, color.ORANGE, color.END, color.YELLOW, color.END, color.RED, color.END))
try:
code = input("Enter your code: ")
except:
quit("")
sum = 0
for letter in code:
for rate in Rates:
if rate.name == letter:
sum += rate.value
apprisal = round(sum * 100 / 45, 0)
print("Your apprisal is at {} %" .format(int(apprisal)))
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment