-
-
Save AngelOnFira/82840e78b2800f356293331d0281a4b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| from collections import defaultdict | |
| t=sys.stdin.readline() | |
| l=[] | |
| while t: | |
| l.append(t.strip()) | |
| t = sys.stdin.readline() | |
| l = l[1:] | |
| coins = 0 | |
| for counts in l: | |
| if len(counts.split()) > 1: | |
| coins += 1 | |
| h=0 | |
| t=0 | |
| for letter in counts.split(): | |
| if letter == 'H': | |
| h+=1 | |
| elif letter == 'T': | |
| t+=1 | |
| if h==t: | |
| print("Coin " + str(coins) + " is fair.") | |
| else: | |
| print("Coin " + str(coins) + " is not fair.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment