Skip to content

Commit Live PR #298

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

Open
wants to merge 6 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
13 changes: 10 additions & 3 deletions q01_read_data/build.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# %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()
Nil=read_data()
Nil


20 changes: 15 additions & 5 deletions q02_teams/build.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# %load q02_teams/build.py
# default imports
from greyatomlib.python_getting_started.q01_read_data.build import read_data
data = read_data()
def teams(data):
Nilesh=data['info']['teams']
return Nilesh
teams(data)

# solution
def teams(data=data):

# write your code here
#teams =
type(data)
data.keys()
data['info']
d=data['info']
type(d)
d.keys()
d['teams']
Nilesh=data['info']['teams']
Nilesh


return teams
26 changes: 24 additions & 2 deletions q03_first_batsman/build.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
# %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):
def first_batsman(data):

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


return batsman






















return name
24 changes: 24 additions & 0 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,29 @@
def deliveries_count(data=data):

# Your code here
count = 0
deliveries = data['innings'][0]['1st innings']['deliveries']
for delivery in deliveries:
for delivery_number, delivery_info in delivery.items():
if delivery_info['batsman'] == 'RT Ponting':
count += 1


return count

type (data)
data.keys()
(data ['innings'])
type (data ['innings'])
len (data ['innings'])
data ['innings'][0]
type(data ['innings'][0])
data['innings'][0].keys()
type(data['innings'][0]['1st innings'])

(data['innings'][0]['1st innings']).keys()
data['innings'][0]['1st innings']['deliveries']
type(data['innings'][0]['1st innings']['deliveries'])
len(data['innings'][0]['1st innings']['deliveries'])