Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 1 pts The for loop, at its simplest, simply obtains values from a collection. Let's start with this simple list data [ 4,

image text in transcribedimage text in transcribed

Question 1 1 pts The for loop, at its simplest, simply obtains values from a collection. Let's start with this simple list data [ 4, 3, 9, 6, 4, 8, 5, 1, 7 Complete this for loop to display all the values on the screen, with one number on each line: for print(value) NOTE: Your answer box should not contain any numbers itself, but instead refer to the variable. Question 3 Of course, it would be good to to something far more interesting than display values in the list. So we will do some simple calculations. For example, a common operation is to add them all up: answer for #your answer to Question 1 print(f The sum is (answer)) The correct sum for these values is 47 NOTE: Yes, there is a sum function that works on lists, but that would not give you any practice with for loops, so don't use it in your answer! Also NOTE: The number 47 may not appear anywhere in your code -- it is there to verify the results. Your solution should work correctly for all lists, not just th given one

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

Transactions On Large Scale Data And Knowledge Centered Systems X Special Issue On Database And Expert Systems Applications Lncs 8220

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2013th Edition

3642412203, 978-3642412202

More Books

Students also viewed these Databases questions

Question

1. Divide the class into groups of three to five students.

Answered: 1 week ago

Question

Write formal proposal requests.

Answered: 1 week ago

Question

Write an effective news release.

Answered: 1 week ago

Question

Identify the different types of proposals.

Answered: 1 week ago