It is the final of the world’s most prestigious cricket tournament, the Indian Premier League. In the final, the Chennai Super Kings (CSK) are playing against the Mumbai Indians (MI). There is one over left for the match to end and CSK require R runs to win with W wickets remaining.
An over consists of 6 balls. Each ball can result in any one of the following possibilities:-
If a ball results in a wicket, CSK’s remaining wickets will decrease by one. If a ball results in runs (either 6, 4, 7, 2 or 1), these runs are added to the runs that CSK have already scored.
The match ends when one of the following happens:-
* If CSK scores R runs, the match ends and CSK wins.
* If the match ends with CSK scoring exactly one run less than the required runs, then the match is a tie.
winningRuns=int(input("Enter the required run for CSK to win match (enter integer value)?"))
wicket=int(input("wicket :"))
score=int(input('Enter the current score:'))
requiredScore=score
print('Run requires to win the match',winningRuns)
print('wicket fall:',wicket)
print('Current score is:',score)
for run in range(6):
runs=int(input('Enter the runs in ball'))
if(runs==6):
score+6
else:
if(runs==4):
score+4
else:
if(runs==3):
score+3
else:
if(runs==7):
score+7
else:
if(runs==2):
score+2
else:
if(runs==1):
score+1
else:
if(runs==0):
score+0
else:
wicket+1
if(requiredScore>score):
print('CSK lost the match by',(requiredScore-score),'runs')
else:
if(requiredScore==score):
print('Match draw')
else:
if(requiredScore<score):
print('CSK won the match by',(11-wicket))
Comments
Leave a comment