Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

Explain all drawbacks of application procedure.

Answered: 1 week ago