
import mlbgame.data

import lxml.etree as etree

def get_league_object():
    """Returns the xml object corresponding to the league
    
    Only designed for internal use"""
    # get data
    data = mlbgame.data.get_properties()
    # return league object
    return etree.parse(data).getroot().find("leagues").find("league")

def league_info():
    """Returns a dictionary of league information"""
    league = get_league_object()
    output = {}
    for x in league.attrib:
        output[x] = league.attrib[x]
    return output

import mlbgame.data

import lxml.etree as etree

def get_league_object():
    """Returns the xml object corresponding to the league
    
    Only designed for internal use"""
    # get data
    data = mlbgame.data.get_properties()
    # return league object
    return etree.parse(data).getroot().find("leagues").find("league")

def league_info():
    """Returns a dictionary of league information"""
    league = get_league_object()
    output = {}
    for x in league.attrib:
        output[x] = league.attrib[x]
    return output

def team_info():
    """Returns a list of team information dictionaries"""
    teams = get_league_object().find("teams").findall("team")
    output = []
    for team in teams:
        info = {}
        for x in team.attrib:
            info[x] = team.attrib[x]
        output.append(info)
    return output

Add function to parse team info
Add function to parse team info

  
  import mlbgame.data
  
  import lxml.etree as etree
  
  def get_league_object():
      """Returns the xml object corresponding to the league
      
      Only designed for internal use"""
      # get data
      data = mlbgame.data.get_properties()
      # return league object
      return etree.parse(data).getroot().find("leagues").find("league")
  
  def league_info():
      """Returns a dictionary of league information"""
      league = get_league_object()
      output = {}
      for x in league.attrib:
          output[x] = league.attrib[x]
      return output
+ 
+ def team_info():
+     """Returns a list of team information dictionaries"""
+     teams = get_league_object().find("teams").findall("team")
+     output = []
+     for team in teams:
+         info = {}
+         for x in team.attrib:
+             info[x] = team.attrib[x]
+         output.append(info)
+     return output
+ 
Add function to parse team info
## Code Before:

import mlbgame.data

import lxml.etree as etree

def get_league_object():
    """Returns the xml object corresponding to the league
    
    Only designed for internal use"""
    # get data
    data = mlbgame.data.get_properties()
    # return league object
    return etree.parse(data).getroot().find("leagues").find("league")

def league_info():
    """Returns a dictionary of league information"""
    league = get_league_object()
    output = {}
    for x in league.attrib:
        output[x] = league.attrib[x]
    return output
## Instruction:
Add function to parse team info
## Code After:

import mlbgame.data

import lxml.etree as etree

def get_league_object():
    """Returns the xml object corresponding to the league
    
    Only designed for internal use"""
    # get data
    data = mlbgame.data.get_properties()
    # return league object
    return etree.parse(data).getroot().find("leagues").find("league")

def league_info():
    """Returns a dictionary of league information"""
    league = get_league_object()
    output = {}
    for x in league.attrib:
        output[x] = league.attrib[x]
    return output

def team_info():
    """Returns a list of team information dictionaries"""
    teams = get_league_object().find("teams").findall("team")
    output = []
    for team in teams:
        info = {}
        for x in team.attrib:
            info[x] = team.attrib[x]
        output.append(info)
    return output
