Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribedimage text in transcribed

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 program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions

Question

Define span of management or define span of control ?

Answered: 1 week ago

Question

What is meant by formal organisation ?

Answered: 1 week ago

Question

What is meant by staff authority ?

Answered: 1 week ago

Question

Discuss the various types of policies ?

Answered: 1 week ago