Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This cell is followed by another Markdown cell with the following content. Define a function add_reverse() that takes a list of numbers and returns Note

This cell is followed by another Markdown cell with the following content. Define a function add_reverse() that takes a list of numbers and returns Note that the name of the function is in monospace font. (Use back quotes.) The next cell is a code cell in which you define function add_reverse(). It is passed a list of numbers and returns the list of numbers obtained by adding to each element in the input list the element in the corresponding position of the reversed version of this list. For example, if the input list is [1, 0, 5, 3], then the reversed version is [3, 5, 0, 1], and what is returned by the function is [4, 5, 6, 4]. (Use function reversed() to reverse the list.) The next cell is a Markdown cell whose content is Call add_reverse(), passing the list [2,0,5,1]. Assign the returned value to res. The name of the function, the list, and the name of the variable are all in monospace font. The next cell contains the code accomplishing this and shows the value for res. (Have res on a line by itself at the end of the cell.) This is followed by a Markdown cell with content Find the sum of the values in res. Again, the name of the variable is in monospace font. The last cell is a code cell that finds the sum of the elements of res. Use sum().

image text in transcribedimage text in transcribedimage text in transcribed

Problem 2 (3 points) Produce a Python 3 Jupyter notebook The 1st cell (a Markdown cell) renders as in the following screenshot COMP 361 & 651 Data Analytics This is the second part of Assignment 2. Purpose This is to give you familiarity with Jupyter. 1 This cell is followed by another Markdown cell with the following content. Define a function add reverse () that takes a list of numbers and returns Note that the name of the function is in monospace font. (Use back quotes.) 1 The next cell is a code cell in which you define function add_reverse () It is passed a list of numbers It returns the list of numbers obtained by adding to each element in the input list the element in the corresponding position of the reversed version of this list E.g., if the input list is [1, 0, 5, 3], athen the reversed version is [3, 5, 0, 1], and what is returned by the function is [4, 5, 6, 4] . 1 1 Use function reversed() to reverse the list The next cell is a Markdown cell whose content is Call add_reverse (), passing the list [2,0,5,1]. Assign the returned value to res. The name of the function, the list, and the name of the variable are all in monospace font The next cell contains the code accomplishing this It also shows the value for res Have res on a line by itself at the end of the cell This is followed by a Markdown cell with content Find the sum of the values in res. Again, the name of the variable is in monospace font The last cell is a code cell that finds the sum of the elements of res o Use sum()

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

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions

Question

Calculate the lifetime value (LTV) of a loyal customer.

Answered: 1 week ago

Question

Use service tiering to manage the customer base and build loyalty.

Answered: 1 week ago