Skip to content

Instantly share code, notes, and snippets.

@AngelOnFira
Created April 6, 2019 15:02
Show Gist options
  • Select an option

  • Save AngelOnFira/82840e78b2800f356293331d0281a4b5 to your computer and use it in GitHub Desktop.

Select an option

Save AngelOnFira/82840e78b2800f356293331d0281a4b5 to your computer and use it in GitHub Desktop.
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