Python Forum

Full Version: python code tp determin a userName and print message
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
am new to programming bearly two weeks and have this question below to answer: i need assistance

5-8. Hello Admin: Make a list of five or more usernames, including the name
'admin'. Imagine you are writing code that will print a greeting to each user
after they log in to a website. Loop through the list, and print a greeting to
each user:
• If the username is 'admin', print a special greeting, such as Hello admin,
would you like to see a status report?
• Otherwise, print a generic greeting, such as Hello Jaden, thank you for
logging in again.
Please make an attempt at writing the code, then ask specific questions for help.
Please read: Homework and No Effort Questions
(Nov-19-2022, 07:59 PM)jackAmin Wrote: [ -> ]... that will print a greeting to each user
after they log in to a website.

Are you sure you need python for this?
yes. i am learning and the poste question is an exercise i have to research on
please here is sample image of the questions:
[attachment=2108][attachment=2108]
The code almost writes itself:

Make a list of five or more usernames, including the name 'admin'

What do you think you could use to loop through the list ?

if the username is 'admin',
print() a special greeting
else
print() a generic greeting,