Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello! I really struggle with my comp sci class and need assistance with this assignment. So far, I have: numbers = [42, 23, 66, 39,
Hello! I really struggle with my comp sci class and need assistance with this assignment.
So far, I have:
numbers = [42, 23, 66, 39, 87, 28] print('The length of the list is ', len(numbers))
index = 0
for index in range(len(numbers)): index += 1 print(numbers)
In your program, define a list and initialize it with the following numbers: 42, 23, 66, 39, 87,28 Then, execute the following tasks: (1) get the length of the list using the len function, and print its length. (2) use the for loop to iterate over each element by their index. Print out all elements together with their indexes. (3) [extra credit 25 Pts] In each iteration of the for loop above, determine if the individual element is an even number, and add the notation "even number" when printing out even numbers. (3) [extra credit 25 Pts] Count the total number of even numbers contained in this list within the same for loop. Print out the total amount by the end of programStep 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