growth_rate
Hi, May be considered a minor issue but when pulling the growth rate from https://pokeapi.co/api/v2/pokemon-species/caterpie/ Caterpie's growth rate is listed as "medium" instead of "medium-fast" FYI
Steps to Reproduce:
- GET https://pokeapi.co/api/v2/pokemon-species/caterpie/
- Look at growth_rate
hmm, thanks. Would you be able to open a PR and fix the issue?
Looking at the growth_rate.csv, the math is correct, but the naming is off.
It should go as:
erratic (very fast to very slow) fast medium-fast medium-slow slow fluctuating (very slow to very fast)
You could probably have a function like this to check the pokemon instead of the CSV. However, it looks very clunky.
def poke_growth(pokemon, n: int):
# n == level of pokemon
# also need to round to nearest whole
match pokemon['growth_rate']:
case 1: # erratic
if n < 50:
growth = ((n**3 * ( 100 - n )) / 50)
elif n >= 50 and n < 68:
growth = ((n**3 * ( 150 - n )) / 100)
elif n >= 68 and n < 98:
growth = ((n**3 * (( 1991 - 10 * n )/3)) / 500)
else:
growth = ((n**3 * (160 - n)) / 100)
return round(growth)
case 2: # fast
growth = (4 * (n**3)) / 5
return round((4 * (n**3)) / 5)
case 3: # medium-fast
return n**3
case 4: # medium-slow
return round(6/5 * (n**3)) - (15 * (n**2)) + (100 * n) - 140
case 5: # slow
return (5 * (n**3)) // 4
case 6: # fluctuating
if n < 15:
growth = n**3 * (((( n+1 ) / 3) + 24) / 50)
if n >= 15 and n < 36:
growth = n**3 * (( n + 14 ) / 50)
else:
growth = n**3 * ((( n/2 ) + 24 ) / 50)
return round(growth)
sources: https://bulbapedia.bulbagarden.net/wiki/Experience