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 49 random integers all from 1 to 16, inclusive. These represent the ages of a population of 49 cats.
Pass the list as the sole argument to the custom value-returning function.
In the custom function:
Sort the list in descending order
Return the sorted list to main
Back in main:
Using loop(s), print a 7 by 7 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 built-in sum function to determine the sum of all ages, and then print the sum.
Use built-in 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 kitten-aged cats from the original list of 49 ages whose ages are less than or equal to 2 then print the count.
Use a list comprehension to create a list of prime-aged cats from the original list of 49 ages whose ages are greater than or equal to 3 and less than or equal to 6. Use a built-in function with the list as an argument to determine the count of prime-aged cats and then print the count.
Do the same for prime-age cats whose ages are greater than or equal to 3 and less than or equal to 6.
Do the same for mature-aged cats whose ages are greater or equal to 7 and less than or equal to 10.
Do the same for senior-aged cats whose ages are greater or equal to 11 and less than or equal to 14.
Dothe same for super senior-aged cats whose ages are greater or equal to 15.

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 Programming Questions!