fname = "input.txt" #sys.argv[1]
with open(fname) as f:
hands = f.read().splitlines()
#f.close()
#print(hands)
for hand in hands:
print(hand, "Straight Flush")
2s:5s:4s:3s:6s Straight Flush 8c:as:7c:ad:3h Straight Flush as:4c:5h:ks:9s Straight Flush 8c:1s:7c:ax:3h Straight Flush 3c:4c:3d:6c:3s Straight Flush 3c:7d:5s:6h:4h Straight Flush
# dictionary is a set of key-value pairs
d = {"John" : ["1234","3433"],
"Alice" : ["9898","1111","2222"]
}
print(d["John"])
d["Jamie"] = ["145","456"]
d["Jamie"] = []
print(d["Jamie"])
['1234', '3433'] []
phones = d.pop("Jamie")
print(d)
print(phones)
{'John': ['1234', '3433'], 'Alice': ['9898', '1111', '2222']} []
s = "hello how are you"
counts = {}
for letter in s:
if letter not in counts:
counts[letter] = 1
else:
counts[letter] = counts[letter] + 1
print(counts)
#print(list(counts.keys()))
for letter in counts:
print(letter,counts[letter])
{'h': 2, 'e': 2, 'l': 2, 'o': 3, ' ': 3, 'w': 1, 'a': 1, 'r': 1, 'y': 1, 'u': 1} h 2 e 2 l 2 o 3 3 w 1 a 1 r 1 y 1 u 1