Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in Python Write your own function, named Greeter , with 2 optional parameters. The first parameter should be named Name and provide a default value

in Python

Write your own function, named Greeter, with 2 optional parameters.

The first parameter should be named Name and provide a default value of "Name". The second parameter should be named Age and provide a default value of 19.

When the function is called, print the following message to the screen if the value of Age is >= 21:

"Hello, Name. The bar is open if you care to drink."

If the value of age is < 21, instead print:

"Hello, Name. Would you like to try our new karaoke system?"

Your output should use the actual values passed as arguments to the parameters.

Example: if Meghan, 20 is passed to your function, the output should be:

"Hello, Meghan. Would you like to try our new karaoke system?"

Additionally, your submitted solution must include a main program which calls your function 2 times. Once using positional arguments. The second time using keyword arguments with the order swapped (age first, then name).

Example: if 23,Manoj is passed to your function using keyword arguments, the output should be:

"Hello, Manoj. The bar is open if you care to drink."

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

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions