I have written a a function list_sum that computes the square of each value in list_1, the cube of each value in list_2, then returns a list containing the element-wise sum of these results. Assume that list_1 and list_2 have the same number of elements in jupyter note books and i have an error popping up. Can you please fix it.
I have written a a function list_sum that computes the square of each value in list_1, the cube of each value in list_2, then returns a list containing the element-wise sum of these results. Assume that list_1 and list_2 have the same number of elements in jupyter note books and i have an error popping up. Can you please fix it.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
I have written a a function list_sum that computes the square of each value in list_1, the cube of each value in
list_2, then returns a list containing the element-wise sum of these results. Assume that list_1 and list_2
have the same number of elements in jupyter note books and i have an error popping up. Can you please fix it.
![def list_sum(list_1, list_2):
result = []
for i in range (len (list_1)):
result.append(list_1[i]**2 + list_2[i]**3)
return result
AttributeError
Input In [59], in <cell line: 5>()
result = []
3
5 for i in range(len(list_1)):
----> 7
Traceback (most recent call last)
result.append(list_1[i]**2 + list_2[i]**3)
9 return result
AttributeError: 'int' object has no attribute 'append'](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F0ba7a132-7931-4407-922e-a5b40e804180%2F48fc9d69-1d6e-4446-b668-10c87161fec9%2Fxs8srbe_processed.png&w=3840&q=75)
Transcribed Image Text:def list_sum(list_1, list_2):
result = []
for i in range (len (list_1)):
result.append(list_1[i]**2 + list_2[i]**3)
return result
AttributeError
Input In [59], in <cell line: 5>()
result = []
3
5 for i in range(len(list_1)):
----> 7
Traceback (most recent call last)
result.append(list_1[i]**2 + list_2[i]**3)
9 return result
AttributeError: 'int' object has no attribute 'append'
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education