Question: Python 3 Write a function named greet_student. The function greet_student takes three parameters 1. state, a string that is a two-letter state abbreviation (e.g., MI,
Python 3
Write a function named greet_student. The function greet_student takes three parameters 1. state, a string that is a two-letter state abbreviation (e.g., MI, NY, NJ) 2. in_msg, a string message that is printed for in-state students 3. out_msg, a string message that is printed for out-of-state students
The function greet_student should 1. ask the user for their name. (Assume that the user responds with valid input.) 2. ask the user what state they are from. (Assume that the user responds with valid input.) 3. print out a personalized response, using the appropriate message (depending on whether they are in-state or out-of-state) and their name 4. return a list containing two strings -- the user's name and the state they are from For example, the following would be correct input and output >>> in_msg = 'You get in-state tuition' >>> out_msg = 'Welcome to our state' >>> student = greet_student('NJ', in_msg, out_msg) What is your name? Rocky What state are you from? MI Welcome to our state Rocky >>> print(student) ['Rocky','MI']
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
