O'Reilly logo
  • Longxiang Lyu thinks this is interesting:

6-6. Polling:


Cover of Python Crash Course


favorite = { 'jen': 'python', 'sarah': 'C', 'edward': 'ruby', 'phil': 'java' }

people have taken the poll

keylist = favorite.keys()

people should take the poll

namelist = {'sarah', 'edward', 'jason', 'alice'} for name in namelist: message = name if name in keylist: message += ", thank you for responding!" else: message += " please take the poll!" print(message)