diff --git a/Chapter_06/6-06_polling.py b/Chapter_06/6-06_polling.py new file mode 100644 index 0000000..054c89b --- /dev/null +++ b/Chapter_06/6-06_polling.py @@ -0,0 +1,22 @@ +# Exercise 6-6 Polling +# Learning Objective: Use an if statement on a loop through a list. + +# favorite_languages.py +favorite_languages = { + 'jen': 'python', + 'sarah': 'c', + 'edward': 'rust', + 'phil': 'python', + } + +poll_takers = ['john', 'stacey', 'edward', 'phil', 'steve'] + +for name in set(poll_takers): + if name in set(favorite_languages.keys()): + print(f"Thank you {name}, for taking part in our poll.") + elif name not in favorite_languages.keys(): + print(f"Hi there {name}, you should take part in our poll") + else: + print("We don't have a record for you, please contact an admin!") + +