diff --git a/q01_read_data/build.py b/q01_read_data/build.py index e13d2f74..afa3b617 100644 --- a/q01_read_data/build.py +++ b/q01_read_data/build.py @@ -1,12 +1,20 @@ +# %load q01_read_data/build.py import yaml def read_data(): - - # import the csv file into `data` variable + with open('./data/ipl_match.yaml') as f: + # import the csv file into variable # You can use this path to access the CSV file: '../data/ipl_match.yaml' # Write your code here - data = + data = yaml.load(f) + + f.close() # return data variable return data + + + + + diff --git a/q02_teams/build.py b/q02_teams/build.py index 3cf9d3cf..3aac64d8 100644 --- a/q02_teams/build.py +++ b/q02_teams/build.py @@ -4,8 +4,8 @@ # solution def teams(data=data): + teams = data['info']['teams'] + return teams + - # write your code here - #teams = - return teams diff --git a/q03_first_batsman/build.py b/q03_first_batsman/build.py index 84984081..dc726944 100644 --- a/q03_first_batsman/build.py +++ b/q03_first_batsman/build.py @@ -1,3 +1,4 @@ +# %load q03_first_batsman/build.py # Default Imports from greyatomlib.python_getting_started.q01_read_data.build import read_data data = read_data() @@ -6,8 +7,8 @@ def first_batsman(data=data): # Write your code here + name = data['innings'][0]['1st innings']['deliveries'][0][0.1]['batsman'] + return name - - return name