Advertisement
AlimusSifar

BPL Mubarak! - Toph.co - Implementation

Oct 2nd, 2020
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. def getCount(over, ball):
  2.     if over != 0 and ball != 0:
  3.         if over > 1 and ball > 1:
  4.             return str(over) + ' OVERS ' + str(ball) + ' BALLS'
  5.         if over > 1 and not ball > 1:
  6.             return str(over) + ' OVERS ' + str(ball) + ' BALL'
  7.         if ball > 1 and not over > 1:
  8.             return str(over) + ' OVER ' + str(ball) + ' BALLS'
  9.         return str(over) + ' OVER ' + str(ball) + ' BALL'
  10.     if over == 0:
  11.         if ball > 1:
  12.             return str(ball) + ' BALLS'
  13.         return str(ball) + ' BALL'
  14.     if ball == 0:
  15.         if over > 1:
  16.             return str(over) + ' OVERS'
  17.         return str(over) + ' OVER'
  18.  
  19.  
  20. T = int(input())
  21.  
  22. for t in range(T):
  23.     S = input()
  24.    
  25.     over = 0
  26.     ball = 0
  27.    
  28.     for c in S:
  29.         if c == 'D' or c == 'N'or c == 'W':
  30.             continue
  31.         elif c == 'O' or int(c) in range(0,7):
  32.             ball = ball + 1
  33.             over = over + int(ball / 6)
  34.             ball = ball % 6
  35.    
  36.     print(getCount(over, ball))
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement