Hi, I made a function out of the json object. The problem is that I get all of the key value pairs at once if I put "return gameday_data". I can't return the key value pairs separately, at least not without making several functions. Is it possible to turn these into a dictionary so I can return all of them and "pick them out" seperatly when I need them? The hashtaged parts is what I tried to do that didn't work.
I'm in a beginner course for python so this is all pretty new.
Here's the code in text:
def get_gameday():
gameday_url = f'{base_url}/api/{season}/{gameday}'
gameday_data = requests.get(gameday_url).json().get('games',{})
for game in gameday_data:
#score = game.get('score')
#home = score.get('home')
#home_team = home.get('team').split(' ')[0]
#home_goal = home.get('goals')
#away = score.get('away')
#away_team = away.get('team').split(' ')[0]
#away_goal = away.get('goals')
#return score, home_team, home_goal, away, away_team, away_goal