Skip to content

Commit Live PR #290

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 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Done
  • Loading branch information
tracedence committed Sep 8, 2018
commit d4dbb46870dcc191ddf8da305223bccda78d3bc8
19 changes: 18 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()
@@ -7,6 +8,22 @@
def BC_runs(data):

# Write your code here

number_of_bowl = len(data['innings'][0]['1st innings']['deliveries']) #no of ball in 1st innings
runs = 0 #to count the number of runs scored by Brendon maCcullum

for ball_no in range(number_of_bowl): #loop over each ball

#return dictionary of particular ball no
di = data['innings'][0]['1st innings']['deliveries'][ball_no]

for ke in di.keys():
if data['innings'][0]['1st innings']['deliveries'][ball_no][ke]['batsman'] == 'BB McCullum':

runs = runs + data['innings'][0]['1st innings']['deliveries'][ball_no][ke]['runs']['batsman']


return(runs)

BC_runs(data)