From 704603252c355c50cdebf988ed2adc45e4f1fc3d Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Wed, 5 Sep 2018 11:50:56 +0000 Subject: [PATCH 1/7] Done --- q01_read_data/build.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/q01_read_data/build.py b/q01_read_data/build.py index e13d2f74..f30fa5aa 100644 --- a/q01_read_data/build.py +++ b/q01_read_data/build.py @@ -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 From 052cbce72fa7d17d7b68b9892fb8f921beba2f95 Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Wed, 5 Sep 2018 11:52:12 +0000 Subject: [PATCH 2/7] Done --- q02_teams/build.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/q02_teams/build.py b/q02_teams/build.py index 3cf9d3cf..52a798a9 100644 --- a/q02_teams/build.py +++ b/q02_teams/build.py @@ -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() @@ -6,6 +7,12 @@ def teams(data=data): # write your code here - #teams = + teams = data['info'] ['teams'] + print(type(teams)) return teams +teams() + + + + From 7036287068a35e2a01dd9f7f984694bd9d15639b Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Wed, 5 Sep 2018 12:06:23 +0000 Subject: [PATCH 3/7] Done --- q03_first_batsman/build.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/q03_first_batsman/build.py b/q03_first_batsman/build.py index 84984081..caff706d 100644 --- a/q03_first_batsman/build.py +++ b/q03_first_batsman/build.py @@ -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() @@ -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 From be4853bd2951f206987d786a1f272cf30761aa50 Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Wed, 5 Sep 2018 18:16:26 +0000 Subject: [PATCH 4/7] Done --- q04_count/build.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/q04_count/build.py b/q04_count/build.py index 6cf3dcbc..93ce6436 100644 --- a/q04_count/build.py +++ b/q04_count/build.py @@ -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 + + From 4847fda229750406aba6a06678448b3a590a2eea Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Wed, 5 Sep 2018 18:29:09 +0000 Subject: [PATCH 5/7] Done --- q05_runs/build.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/q05_runs/build.py b/q05_runs/build.py index a250631a..da62860d 100644 --- a/q05_runs/build.py +++ b/q05_runs/build.py @@ -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,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) From 1ec34588cdf0f310527f8865d53664225f3e280e Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Wed, 5 Sep 2018 20:01:42 +0000 Subject: [PATCH 6/7] Done --- q06_bowled_players/build.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/q06_bowled_players/build.py b/q06_bowled_players/build.py index 914cb6d2..59778971 100644 --- a/q06_bowled_players/build.py +++ b/q06_bowled_players/build.py @@ -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() @@ -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_playesr=c + return bowled_players + +bowled_out - return bowled_players From e449602f909cfe0fe900392c00345eec821e99c2 Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Fri, 28 Sep 2018 14:54:06 +0000 Subject: [PATCH 7/7] Done --- q06_bowled_players/build.py | 2 +- q07_extras/build.py | 33 +++++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/q06_bowled_players/build.py b/q06_bowled_players/build.py index 59778971..f1ca4e2c 100644 --- a/q06_bowled_players/build.py +++ b/q06_bowled_players/build.py @@ -19,7 +19,7 @@ def bowled_out(data=data): c.append(x[y]['wicket']['player_out']) - bowled_playesr=c + bowled_players=c return bowled_players bowled_out diff --git a/q07_extras/build.py b/q07_extras/build.py index cdeb803b..63ba5af3 100644 --- a/q07_extras/build.py +++ b/q07_extras/build.py @@ -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