Question: In the main function of your script, follow these steps: Use a list comprehension to generate 4 9 random integers all from 1 to 1
In the main function of your script, follow these steps:
Use a list comprehension to generate random integers all from to inclusive. These represent the ages of a population of cats.
Pass the list as the sole argument to the custom valuereturning function.
In the custom function:
Sort the list in descending order
Return the sorted list to main
Back in main:
Using loops print a by representation of the ages returned by the custom function. The ages should be in descending order and evenly spaced. After the loop terminates use the builtin sum function to determine the sum of all ages, and then print the sum.
Use builtin functions to determine the ages of the oldest and youngest cats, then print their ages.
Determine the average age by making use of the sum of all ages referenced above, then print the average age so that two decimal positions are included.
Make additive use of the count method to count the number of kittenaged cats from the original list of ages whose ages are less than or equal to then print the count.
Use a list comprehension to create a list of primeaged cats from the original list of ages whose ages are greater than or equal to and less than or equal to Use a builtin function with the list as an argument to determine the count of primeaged cats and then print the count.
Do the same for primeage cats whose ages are greater than or equal to and less than or equal to
Do the same for matureaged cats whose ages are greater or equal to and less than or equal to
Do the same for senioraged cats whose ages are greater or equal to and less than or equal to
Dothe same for super senioraged cats whose ages are greater or equal to
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
