Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commit Live PR #287

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
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
14 changes: 8 additions & 6 deletions q01_read_data/build.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# %load q01_read_data/build.py

import yaml

def read_data():
with open('./data/ipl_match.yaml', 'r') as x:
data=yaml.load(x)
return (data)


print(read_data())

# import the csv file into `data` variable
# You can use this path to access the CSV file: '../data/ipl_match.yaml'
# Write your code here

data =

# return data variable
return data
9 changes: 8 additions & 1 deletion q02_teams/build.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# %load q02_teams/build.py
# default imports
from greyatomlib.python_getting_started.q01_read_data.build import read_data
data = read_data()
Expand All @@ -6,6 +7,12 @@
def teams(data=data):

# write your code here
#teams =
teams = data['info'] ['teams']
print(type(teams))

return teams
teams()




9 changes: 6 additions & 3 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,10 @@
def first_batsman(data=data):

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

return name
first_batsman()




return name
15 changes: 11 additions & 4 deletions q04_count/build.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# %load q05_runs/build.py
# Default Imports
from greyatomlib.python_getting_started.q01_read_data.build import read_data
data = read_data()

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

# Your code here


count = 0
l = data['innings'][0]['1st innings']['deliveries']
for x in l:
for y in x:
if(x[y]['batsman']) == 'RT Ponting':
count=count+1

return count
deliveries_count


13 changes: 12 additions & 1 deletion q05_runs/build.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# %load q05_runs/build.py
# Default Imports
from greyatomlib.python_getting_started.q01_read_data.build import read_data
data = read_data()
Expand All @@ -7,6 +8,16 @@
def BC_runs(data):

# Write your code here
l=(data['innings'][0]['1st innings']['deliveries'])
c=0
for x in l:
for y in x:
if(x[y]['batsman']) == 'BB McCullum':
c+=(x[y]['runs']['batsman'])

runs=c
return runs

BC_runs


return(runs)
18 changes: 17 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,21 @@
def bowled_out(data=data):

# Write your code here
l=(data['innings'][1]['2nd innings']['deliveries'])
c=[]

for x in l:
for y in x:
if 'wicket' in x[y]:

if 'bowled' in x[y]['wicket']['kind']:
print(x[y]['wicket']['player_out'])

c.append(x[y]['wicket']['player_out'])

bowled_players=c
return bowled_players

bowled_out


return bowled_players
33 changes: 27 additions & 6 deletions q07_extras/build.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
# %load q07_extras/build.py
# Default Imports
from greyatomlib.python_getting_started.q01_read_data.build import read_data
data = read_data()

# Your Solution
def extras_runs(data=data):

# Write your code here


difference =
# Your Solution
def extras_runs(data=data):

ball = data['innings'][0]['1st innings']['deliveries']
list_of_a=[]
for x in range(len(ball)):
d = data['innings'][0]['1st innings']['deliveries'][x]

for v in d.keys():
if 'extras'in d[v]:
list_of_a.append(d[v]['extras'])


ball2 = data['innings'][1]['2nd innings']['deliveries']
list_of_b= []
for x in range(len(ball2)):
d2 = data['innings'][1]['2nd innings']['deliveries'][x]

for v2 in d2.keys():
if 'extras'in d2[v2]:
list_of_b.append(d2[v2]['extras'])


diffrence = len(list_of_b) - len(list_of_a)
return diffrence
extras_runs(data)


return difference