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
5 changes: 4 additions & 1 deletion q01_read_data/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ def read_data():
# You can use this path to access the CSV file: '../data/ipl_match.yaml'
# Write your code here

data =

file_path = 'data/ipl_match.yaml'
with open(file_path) as yaml_file:
data = yaml.load(yaml_file)

# return data variable
return data
3 changes: 2 additions & 1 deletion q02_teams/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
def teams(data=data):

# write your code here
#teams =
teams =data['info']['teams']

return teams
teams()
3 changes: 2 additions & 1 deletion q03_first_batsman/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ def first_batsman(data=data):

# Write your code here


name=data['innings'][0]['1st innings']['deliveries'][0][0.1]['batsman']


return name
first_batsman()
9 changes: 7 additions & 2 deletions q04_count/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

# Your Solution Here
def deliveries_count(data=data):

# Your code here

count = 0
for balls in data['innings'][0]['1st innings']['deliveries']:
for key, value in balls.items():
if value['batsman'] == 'RT Ponting':
count += 1

return count
deliveries_count()
9 changes: 7 additions & 2 deletions q05_runs/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
def BC_runs(data):

# Write your code here


runs = 0
for balls in data['innings'][0]['1st innings']['deliveries']:
for key, value in balls.items():
if value['batsman'] == 'BB McCullum':
runs += value['runs']['batsman']
return(runs)

BC_runs(data)