Question: Python Create an empty list called numbers and initialize a counter i by assigning it to a value of 1. Write a for-loop that uses
Python
Create an empty list called numbers and initialize a counter i by assigning it to a value of 1. Write a for-loop that uses fave as the loop variable and your top ten list as the iterable. For each pass of the loop, append the counter to the numbers list and then use augmented assignment to increment the value of the counter.
1 1. almond croissants
2 2. art
3 3. cookies
and so on
Next, use a for-loop to sum the numbers and find the average using 2 the len() function in the denominator. Use augmented assignment to add to your accumulator. Dont forget to initialize your accumulator to 0! Your answer should be 5.5.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
