0% found this document useful (0 votes)
2 views

m3 python

The document contains a Python script that imports a score_calculator module and calculates scores for a list of cricket players based on their roles as batsmen or bowlers. It iterates through player dictionaries, computes their scores, and identifies the maximum scorer. Additionally, it includes a name and email at the end, likely for contact purposes.

Uploaded by

akumar07067
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

m3 python

The document contains a Python script that imports a score_calculator module and calculates scores for a list of cricket players based on their roles as batsmen or bowlers. It iterates through player dictionaries, computes their scores, and identifies the maximum scorer. Additionally, it includes a name and email at the end, likely for contact purposes.

Uploaded by

akumar07067
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

import score_calculator #Importing score_calculator module

#Giving Inputs as dictionary

p1={'name':'Virat Kohli', 'role':'bat', 'runs':112, '4':10, '6':0, 'balls':119, 'field':0}

p2={'name':'du Plessis', 'role':'bat', 'runs':120, '4':11, '6':2, 'balls':112, 'field':0}

p3={'name':'Bhuvneshwar Kumar', 'role':'bowl', 'wkts':1, 'overs':10, 'runs':71, 'field':1}

p4={'name':'Yuzvendra Chahal', 'role':'bowl', 'wkts':2, 'overs':10, 'runs':45, 'field':0}

p5={'name':'Kuldeep Yadav', 'role':'bowl', 'wkts':3, 'overs':10, 'runs':34, 'field':0}

players = [p1,p2,p3,p4,p5] # Making a list of dictionaries so that we can iterate through each
dictionary

scores = {}

for i in players:

if i['role'] == 'bat':

score = score_calculator.batscore(i)

scores[i['name']] = score

print("'name':{},'batscore':{}".format(i['name'],score))

else:

score = score_calculator.bowlscore(i)

scores[i['name']] = score

print("'name':{},'bowlscore':{}".format(i['name'],score))

max_scorer = max(scores,key=scores.get)

print("The maximum scorer is {} with score {}".format(max_scorer,max(scores.values())))

name Sudhir kumar

email [email protected]

You might also like