Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please strictly follow the instruction and troubleshoot!thanks python python In this lab, you will practice: - writing a function to match the specifications - using
please strictly follow the instruction and troubleshoot!thanks
python
python
In this lab, you will practice: - writing a function to match the specifications - using string concatenation or fstrings to generate a new string value - writing the main program to call your function Instructions 1. Write a function create_password () expects two parameters: pet_name (a string) and fav_number (an integer). The function returns a new password generated using the following pattern: If fav_number followed by the pet_name followed by the star * and fav_number again (see the example below). 2 Create a program that gets a pet name and a favorite number as input from the user, calls the above function, and then prints the output as shown below. Example Input: Angel 3 Output: Your new password is "3Angel.3". Note that the double quotes are part of the output. The asser t in the provided template is checking that this function call is returning the correct value (i.e., a correctly-formed string) assert ereate password ("Ange.", 3)= " 3 Angel 3" Hints - Remember that you cannot directly concatenate an integer and a string - you need to convert an integer into a string using either st r() or by using f-strings. Troubleshooting - If you are getting AssertionError make sure that your create_password() function is returning the correct value. - If you are failing the Unit Tests but passing all of the "Compare Output' tests. make sure that your create_password () function is returning the correct value. This error is likely due to the if _ name _ =-main _ ': block printing the night value, but the function create_password() is not creating/returning the correct value. 3.Unit test ^ 0/3 create_password(Pirate, 8) Your output Test feecback create_password ('pirate', 8); did not return a value. Xour function may be missing a return statement. 4.Unit test 0/3 create_password(Rocky', 7) Your output Test feedback areate password('Rocky', 7) i did not return a value. Your function may be missing a return statement 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