Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions q01_read_data/build.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# %load q01_read_data/build.py
import yaml

def read_data():

# import the csv file into `data` variable
# 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(open('./data/ipl_match.yaml'))
# return data variable
return data

read_data()



11 changes: 9 additions & 2 deletions q02_teams/build.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# %load q02_teams/build.py
# default imports
from greyatomlib.python_getting_started.q01_read_data.build import read_data
data = read_data()

# solution
def teams(data=data):
def teams(data):

# write your code here
#teams =

teams = []
teams = data['info']['teams']
return teams

ipl_teams = teams(data)



6 changes: 4 additions & 2 deletions q03_first_batsman/build.py
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -6,8 +7,9 @@
def first_batsman(data=data):

# Write your code here
name = data['innings'][0]['1st innings']['deliveries'][0][0.1]['batsman']
return name

name = first_batsman(data)



return name
14 changes: 12 additions & 2 deletions q04_count/build.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# %load q04_count/build.py
# Default Imports
from greyatomlib.python_getting_started.q01_read_data.build import read_data
data = read_data()
Expand All @@ -6,6 +7,15 @@
def deliveries_count(data=data):

# Your code here


del_list = []
del_list = data['innings'][0]['1st innings']['deliveries']
count = 0
del_dict = {}
for i in del_list:
del_dict = i
for key, value in del_dict.items():
if(value['batsman'] == 'RT Ponting'):
count += 1
return count


18 changes: 16 additions & 2 deletions q05_runs/build.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
# %load q05_runs/build.py
# Default Imports
from greyatomlib.python_getting_started.q01_read_data.build import read_data
data = read_data()


# Your Solution
def BC_runs(data):

# Write your code here
runs = 0
del_list = []
del_list = data['innings'][0]['1st innings']['deliveries']
count = 0
del_dict = {}
for i in del_list:
del_dict = i
for key, value in del_dict.items():
if(value['batsman'] == 'BB McCullum'):
runs += value['runs']['batsman']
print(runs)
return(runs)




return(runs)
16 changes: 15 additions & 1 deletion q06_bowled_players/build.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# %load q06_bowled_players/build.py
# Default Imports
from greyatomlib.python_getting_started.q01_read_data.build import read_data
data = read_data()
Expand All @@ -6,6 +7,19 @@
def bowled_out(data=data):

# Write your code here
del_list = []
del_list = data['innings'][1]['2nd innings']['deliveries']
bowled_players = []
del_dict = {}
wicket_dict = {}
for i in del_list:
del_dict = i
for key, value in del_dict.items():
wicket_dict = value
if 'wicket' in wicket_dict:
if(wicket_dict['wicket']['kind'] == 'bowled'):
bowled_players.append(wicket_dict['wicket']['player_out'])

return bowled_players


return bowled_players
30 changes: 27 additions & 3 deletions q07_extras/build.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# %load q07_extras/build.py
# Default Imports
from greyatomlib.python_getting_started.q01_read_data.build import read_data
data = read_data()
Expand All @@ -6,9 +7,32 @@
def extras_runs(data=data):

# Write your code here

del_list = []
del_list2 = []
del_list = data['innings'][0]['1st innings']['deliveries']
del_list2 = data['innings'][1]['2nd innings']['deliveries']
extras_1 = 0
extras_2 = 0
del_dict = {}
del_dict2 = {}
check_dict = {}
for i in del_list:
del_dict = i
for key, value in del_dict.items():
check_dict = value
if('extras' in check_dict.keys()):
extras_1 += 1

for i in del_list2:
del_dict2 = i
for key, value in del_dict2.items():
check_dict = value
if('extras' in check_dict.keys()):
extras_2 += 1

difference = extras_2 - extras_1
return abs(difference)


difference =


return difference