Skip to content

Commit 9fcd149

Browse files
committed
assignment 2 task 2
1 parent 07894d8 commit 9fcd149

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

07. dictionaries/Assignment_2.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,28 @@
1919
print(val)
2020

2121

22+
#! Task 2:
23+
# . Polling: Use the code in favorite_languages.py
24+
# • Make a list of people who should take the favorite languages poll. Include
25+
# some names that are already in the dictionary and some that are not.
26+
# • Loop through the list of people who should take the poll. If they have
27+
# already taken the poll, print a message thanking them for responding.
28+
# If they have not yet taken the poll, print a message inviting them to take
29+
# the poll
2230

31+
fav_languages = {
32+
'kamran': 'c',
33+
'shadman': 'python',
34+
'jawad': 'javascript',
35+
}
36+
37+
print("")
38+
poll_lists = ['shadman', 'jawad', 'hameed', 'ali', 'kamran']
39+
40+
for plist in poll_lists:
41+
if plist in fav_languages.keys():
42+
print(f"\n{plist} Thank you! for participating in polls")
43+
else:
44+
print(f"\n{plist} please participate in poll, you are invited..")
2345

2446

0 commit comments

Comments
 (0)