Skip to content

Commit 9bab11e

Browse files
committed
userinputs
1 parent b5674e8 commit 9bab11e

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

08. userinputs & while loops/4. userinput_&_dictionary.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,19 @@
66
# Set a flag to indicate that polling is active.
77
flag = True
88

9+
while flag:
10+
name = input("\nplease enter your name: ")
11+
fav_lang = input("\nplease enter your fav programming language: ")
12+
languages[name] = fav_lang
13+
14+
another_poll = input("\ndo you want to take another poll. type 'yes/no': ")
15+
if another_poll == 'no':
16+
flag = False
17+
18+
19+
print(f"\npoll info are as follows:")
20+
for key,val in languages.items():
21+
print(f"\t{key} : {val}")
22+
23+
#* The program first defines an empty dictionary (responses) and sets a flag (polling_active) to indicate that polling is active.
24+
# As long as polling_active is True, Python will run the code in the while loop

0 commit comments

Comments
 (0)