Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print('Has rain delayed your cricket match? Use this handy calculator to work out how many overs you can play once the rain stops')
- match_duration = float(input('How many whole hours in total does your cricket match go for? '))
- innings_overs = int(input('How many overs per innings? '))
- rain_shortened = float(input('How many hours left for the match after the rain delay? '))
- match_total_minutes = match_duration*60
- over_duration = match_total_minutes/innings_overs/2
- new_duration_minutes = rain_shortened*60
- shortened_total_overs = new_duration_minutes/over_duration
- new_overs_each_team = shortened_total_overs//2
- tea_duration = new_duration_minutes%over_duration
- if rain_shortened > match_duration:
- print('The rain-shortened match needs to be shorter than the normal match')
- elif new_duration_minutes <over_duration*2:
- print('You do not have enough time to play cricket but you do have ', tea_duration,'minutes for tea')
- elif (shortened_total_overs%2) == 0:
- print('You have exactly enough time to play ', new_overs_each_team,'overs each!')
- elif (shortened_total_overs%2) != 0:
- print('You have enough time to play ', new_overs_each_team,'overs each and ', round(tea_duration), 'minutes for tea')
Add Comment
Please, Sign In to add comment