-
Notifications
You must be signed in to change notification settings - Fork 0
/
forloop_Quiz.py
51 lines (30 loc) · 988 Bytes
/
forloop_Quiz.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python
# coding: utf-8
# # Quiz 1
# In[8]:
# Create a list of full names
names = ['Joey Tribbiani', 'Monica Gellar', 'Chandler Bing', 'Phueobe Buffay']
# Initialize an empty list to store usernames
usernames = []
# Iterate through each full name
for u_names in names:
# Convert the name to lowercase and replace spaces with underscores
usernames.append(u_names.casefold().replace(" ", "_"))
# Print the list of generated usernames
print(usernames)
# In[10]:
# Create a list of full names
names = ['Joey Tribbiani', 'Monica Gellar', 'Chandler Bing', 'Phueobe Buffay']
# Iterate through each full name
for u_names in names:
# Convert and print the name to lowercase and replace spaces with underscores
print(u_names.casefold().replace(" ", "_"))
# # Quiz 2
# In[14]:
items = ['first string', 'second string']
html_str = "</u>\n"
for item in items:
html_str += "<li>{}</li>\n".format(item)
html_str += "</ul>"
print(html_str)
# In[ ]: