Files
grokking_algorithms/05_hash_tables/python/02_check_voter.py

12 lines
203 B
Python

voted = {}
def check_voter(name):
if voted.get(name):
print("kick them out!")
else:
voted[name] = True
print("let them vote!")
check_voter("tom")
check_voter("mike")
check_voter("mike")