Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2020
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. line = input().split(", ")
  2. for i in range(len(line)):
  3.     line[i] = line[i].strip()
  4. uni = "@#$^"
  5. for word in line:
  6.     symbol = sorted(word, key=lambda s: word.count(s))[-1]
  7.     if not len(word) == 20:
  8.         print("invalid ticket")
  9.         continue
  10.     elif len(word) == 20:
  11.         if symbol not in uni:
  12.             print(f'ticket "{word}" - no match')
  13.             continue
  14.         elif symbol in uni and word.count(symbol) >= 12:
  15.             left_side = word[:10]
  16.             right_side = word[10:]
  17.             if word.count(symbol) == 20:
  18.                 print(f'ticket "{word}" - 10{symbol} Jackpot!')
  19.                 continue
  20.             elif symbol * 6 in left_side and symbol * 6 in right_side:
  21.                 min_count = min(left_side.count(symbol), right_side.count(symbol))
  22.                 print(f'ticket "{word}" - {min_count}{symbol}')
  23.             else:
  24.                 print(f'ticket "{word}" - no match')
  25.         else:
  26.             print(f'ticket "{word}" - no match')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement