Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In the cell below is an example of a nested loop. Beginning with your code from Question 5 ( and using the nested loop example

In the cell below is an example of a "nested loop." Beginning with your code from Question 5(and using the nested loop example below as a reference), write a loop inside your loop from Question 5 that calculates (x+y)2 for every value of y(i.e. your inner loop should be over the list of y-values) and appends it to a new list xy?squared. In your outer loop, print out that list.
If you've done this correctly, then the first list you get should look like the following:
144,105.0625,90.25,81,72.25,81,90.25,105.0625,144
which is (2+10)???2,(2+8.25)???2,(2+7.5)???2,(2+7)???2,(2+6.5)???2,(2+7)???2,(2+7.5)???2,(2+8.25)???2,(2+10)???2.
The next list should be the result of (-4+10)???2,(4+8.25)???2,(4+7.5)??2,(4+7)???2,(4+6.5)???2,(4+7)???2,(4+7.5)???2,(4+8.25)???2,(4+10)???2 because you should move on to the next value in the x list. This will look like:
196,150.0625,132.25,121,110.25,121,132.25,150.0625,196
Yes, this might seem a bit complicated -- that's totally expected. After all, you're still learning to write code! If you find yourself spending too much time to figure this out, make use of Teams or try to drop by office hours or help room hours. Making sure that you spend time on your own trying to work through pre-class activities like this one are important for making your time in class as productive as possible.
image text in transcribed

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_2

Step: 3

blur-text-image_3

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 Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions

Question

Outline how finance leases are recorded and accounted for.

Answered: 1 week ago

Question

=+Did it ange the way you thought or felt about that celebrity?

Answered: 1 week ago

Question

What styles do they use?

Answered: 1 week ago

Question

create a semiotic sign system to communicate an idea.

Answered: 1 week ago

Question

apply research strategies to writing.

Answered: 1 week ago