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
2 changes: 1 addition & 1 deletion q01_read_data/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def read_data():
# 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','r'))

# return data variable
return data
4 changes: 2 additions & 2 deletions q02_teams/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

# solution
def teams(data=data):

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

return teams
6 changes: 1 addition & 5 deletions q03_first_batsman/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

# Your Solution
def first_batsman(data=data):

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




return name
10 changes: 8 additions & 2 deletions q04_count/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@

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

count = 0
a = data['innings'][0]['1st innings']['deliveries']
for i in range(len(a)):
for k in a[i]:
if a[i][k]['batsman'] == 'RT Ponting':
count += a[i][k]['runs']['batsman']

# Your code here


return count
7 changes: 7 additions & 0 deletions q05_runs/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@

# Your Solution
def BC_runs(data):
runs = 0
b = data['innings'][0]['1st innings']['deliveries']
for i in range(len(b)):
for k in b[i]:
if b[i][k]['batsman'] == 'BB McCullum':
runs += b[i][k]['runs']['batsman']


# Write your code here

Expand Down
9 changes: 8 additions & 1 deletion q06_bowled_players/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@

# Your Solution
def bowled_out(data=data):

bowled_players = []
b = data['innings'][1]['2nd innings']['deliveries']
for i in range(len(b)):
for j in b[i]:
for k in b[i][j]:
if k == 'wicket':
if b[i][j][k]['kind'] == 'bowled':
bowled_players += [b[i][j][k]['player_out']]
# Write your code here


Expand Down
18 changes: 16 additions & 2 deletions q07_extras/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,25 @@

# Your Solution
def extras_runs(data=data):
inning1,inning2 = [],[]
b = data['innings'][0]['1st innings']['deliveries']
for i in range(len(b)):
for j in b[i]:
for k in b[i][j]:
if k == 'extras':
for x in b[i][j][k]:
inning1 += [b[i][j][k][x]]
b = data['innings'][1]['2nd innings']['deliveries']
for i in range(len(b)):
for j in b[i]:
for k in b[i][j]:
if k == 'extras':
inning2 +=[1]

difference = 6

# Write your code here


difference =


return difference