Question
Write a function named greeting(). The function greeting() should ask the user for their name, and then ask the user for the day of the
Write a function named greeting(). The function greeting() should ask the user for their name, and then ask the user for the day of the week. It should then greet the person by name and day and comment whether their name has fewer, more than or the same number of characters as the day.
I have started the coding with:
def greeting(greetStr):
name = input("What is your first name?: ")
day = input("What day of the week is it?: ")
print (greetStr + ' ' + day, name)
I'm not sure how to do the if statements correctly as well as the for loop. Could I get actual feedback on the process you went through to get the rest of code. I know this is incorrect but this was the if statements I used. I'm not sure what I am missing.
if name < day: print("Your name has fewer number of characters than today!") elif name > day: print("Your name has more characters than today!") else: print("Your name has the same number of characters as today!")
greeting('Happy')
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started