python-crash-course/Chapter_05/5-09_no_users.py
2025-01-26 13:19:30 -05:00

15 lines
436 B
Python

# Exercise 5-9 No Users
# Learning Objective: Expand 5-8 program Hello Admin to ensure list isn't empty.
users = ['tex', 'spert', 'klumps20', 'porridgeboi', 'admin']
#users = [] #test empty list
if users:
for user in users:
if user == 'admin':
print(f'Hello {user.title()}, would you like to see a report?')
else:
print(f'Hello {user.title()}, thank you for logging in again.')
else:
print('We need to find some users!')