Question: python programming, Task 3: Write a function called choose_pet_name(species, gender) that accepts two parameters: species and gender. Inside the function, create four lists of pet

python programming,

python programming, Task 3: Write a function called choose_pet_name(species, gender) that accepts

Task 3: Write a function called choose_pet_name(species, gender) that accepts two parameters: species and gender. Inside the function, create four lists of pet names: one for female cats, one for male cats, one for female dogs, and one for male dogs. Make sure each list has at least 5 appropriate, non-offensive names in it. Assign each list to a separate variable. For example, the following are some partial lists to get you started cat female ["Kitty" "Girlfriend", "Daisy"...] cat maleMurphy" "Mac", "Tom", .] dog female "Pepper", "Fluffy".... dog male ["Spot", "Rover",...] Based on the values passed to the species parameter (either "cat" or "dog") and to the gender parameter ("male", "female" or "any" or the empty string "" or anything other than "male" or "female"), your program should randomly choose a name from the corresponding list of names. If the gender is "any" or any other value or the empty string, your function should randomly choose any of the names that are listed for the species (that is, from the female and male names combined) without concern for the gender. (Hint: you can create a new list by adding together two lists.) Your function should return the chosen name. Make sure that your function works regardless of the case of the values passed to the function. Also, your function should return None if anything other than (case-insensitive) "cat" or "dog" is passed for the species For example (based on sample lists): choose-pet-name("cat", "FEMALE") ==> "Girlfriend" choose_pet_name("caT"', "") choose_pet_name("doG", "Any") choose_pet_name("doG",") choose_pet_name("armadillo", "neuter"None choose_pet_ name("python", "FEMALE")None "Tom' "Fluffy" "Rover

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!