Hi I am trying to call API and get a growth rate of poke API. I am sort of stuck now and return experience += 1 part gives me syntax error as well. Can you drop me a hint? Or how I should approach?
I intended to get each level & experience level from the first function then calculate the growth rate at the second function, the first part works but I got stuck at the second part.
import json
import requests
import pandas as pd
import matplotlib.pyplot as plt
def get_growth_rate(rate):
request1=requests.get(rate)
loaded1= json.loads(request1.content)
try:
descriptions,formula,id_1,levels,name,pokemon_species = loaded1.values()
return levels
except IndexError:
return None
pass
def plot_growth_rate(levels):
experience=[]
levels[0],levels[1] = get_growth_rate(rate)
for i in level[0]:
return experience += 1
growth_rate = (experience[i+1]-experience[i]/experience[i])) * 100
get_growth_rate("https://pokeapi.co/api/v2/growth-rate/5")
return experience += 1should do?