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
11 changes: 7 additions & 4 deletions q01_read_data/build.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# %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.safe_load(open('./data/ipl_match.yaml'))

# return data variable
return data

read_data()

12 changes: 9 additions & 3 deletions q02_teams/build.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# %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):
lst = []

def teams(data):
lst.append(data['info']['teams'])
# write your code here
#teams =

return lst[0]

teams(data)
lst[0]

return teams
5 changes: 4 additions & 1 deletion q03_first_batsman/build.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# %load q03_first_batsman/build.py
# Default Imports
from greyatomlib.python_getting_started.q01_read_data.build import read_data
data = read_data()

# Your Solution
def first_batsman(data=data):
name=data['innings'][0]['1st innings']['deliveries'][0][0.1]['batsman']

# Write your code here




return name
first_batsman(data)

20 changes: 19 additions & 1 deletion q04_count/build.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
# %load q04_count/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):
count=0
deliveries = data['innings'][0]['1st innings']['deliveries']
b = 0.1
for a in range(len(deliveries)):
for b in deliveries[a]:
print(deliveries[a][b]['batsman'])
if (deliveries[a][b]['batsman']=='RT Ponting'):
count+=1
return count



# Your code here


deliveries_count(data)
#lst[0][46][7.3]['batsman']
#list(range(lst[0][1],lst[0][123]))
#data['innings'][0]['1st innings']['deliveries']
current_deliveries

return count
13 changes: 11 additions & 2 deletions q05_runs/build.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
# %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
data1=data['innings'][0]['1st innings']['deliveries']
for i in data1:
data2=list(i.values())
if data2[0]['batsman']=='BB McCullum':
if data2[0]['runs']['batsman']>0:
runs=runs+data2[0]['runs']['batsman']

return(runs)
BC_runs(data)

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

# Your Solution
def bowled_out(data=data):

bowled_players = []
# Write your code here
delivery = data['innings'][1]['2nd innings']['deliveries']
for balls in delivery:
data1 = list(balls.values())
if 'wicket' in data1[0].keys():
if data1[0]['wicket']['kind']=='bowled':
bowled_players.append(data1[0]['batsman'])
return bowled_players

bowled_out(data)





return bowled_players