def reverse_reversed(items): Create|and return a new list that contains the items in reverse, but so that whenever each item is itself a list, its elements are also reversed. This reversal of sublists must keep going on all the way down, no matter how deep the nesting of these lists, so you ought to use recursion to solve this problem. The base case handles any argument that is not a list. When the items parameter is a list (use the Python function type or the isinstance operator to check this), recursively reverse the elements that this nested list contains. (List comprehensions might come handy in doing this part of the problem.) Note that this function must create and return a new list to represent the result, and should not rearrange or otherwise mutate the contents of the original list. This same principle should apply to all functions that receive a list argument. In your own programs that compute some important list that you pass to some function from the standard library, isn't life easier when you never have to worry of that function silently mutating the contents of your list? Expected result [5, ['yeah', 4, 3, 21, 1] items [1, [2, 3, 4, 'yeah'], 5] [נננ[[2 ,1זזtttt נננ[[[1 ,2וזזזtt [42, [99, [17, [33, ['bool']]]]][[[[['bool'], 33], 17], 991, 42]
def reverse_reversed(items): Create|and return a new list that contains the items in reverse, but so that whenever each item is itself a list, its elements are also reversed. This reversal of sublists must keep going on all the way down, no matter how deep the nesting of these lists, so you ought to use recursion to solve this problem. The base case handles any argument that is not a list. When the items parameter is a list (use the Python function type or the isinstance operator to check this), recursively reverse the elements that this nested list contains. (List comprehensions might come handy in doing this part of the problem.) Note that this function must create and return a new list to represent the result, and should not rearrange or otherwise mutate the contents of the original list. This same principle should apply to all functions that receive a list argument. In your own programs that compute some important list that you pass to some function from the standard library, isn't life easier when you never have to worry of that function silently mutating the contents of your list? Expected result [5, ['yeah', 4, 3, 21, 1] items [1, [2, 3, 4, 'yeah'], 5] [נננ[[2 ,1זזtttt נננ[[[1 ,2וזזזtt [42, [99, [17, [33, ['bool']]]]][[[[['bool'], 33], 17], 991, 42]
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
Please help solve the python problem, thank you
![Reversing the deserver
def reverse_reversed (items):
Create and return a new list that contains the iteme in reverse, but so that whenever each item is
itself a list, its elements are also reversed. This reversal of sublists must keep going on all the way
down, no matter how deep the nesting of these lists, so you ought to use recursion to solve this
problem. The base case handles any argument that is not a list. When the itema parameter is a list
(use the Python function type or the isinstance operator to check this), recursively reverse the
elements that this nested list contains. (List comprehensions might come handy in doing this part of
the problem.)
Note that this function must create and return a new list to represent the result, and should not
rearrange or otherwise mutate the contents of the original list. This same principle should apply to
all functions that receive a list argument. In your own programs that compute some important list
that you pass to some function from the standard library, isn't life easier when you never have to
worry of that function silently mutating the contents of your list?
Expected result
items
[1, [2, 3, 4, 'yeah'], 5]
[5, ['yeah', 4, 3, 21, 1]
[[[[[[1, 2111]]]
[[[[[[2, 1]]11]]
[42, [99, [17, [33, ['bool']]]]] [[[[['boo!'], 33], 17], 991,
42]](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F0f4c3b8d-420b-4827-8129-a9e5c9a665e1%2Fb81bec82-79a5-4e14-9aef-94f075d80837%2F2nocqkf_processed.png&w=3840&q=75)
Transcribed Image Text:Reversing the deserver
def reverse_reversed (items):
Create and return a new list that contains the iteme in reverse, but so that whenever each item is
itself a list, its elements are also reversed. This reversal of sublists must keep going on all the way
down, no matter how deep the nesting of these lists, so you ought to use recursion to solve this
problem. The base case handles any argument that is not a list. When the itema parameter is a list
(use the Python function type or the isinstance operator to check this), recursively reverse the
elements that this nested list contains. (List comprehensions might come handy in doing this part of
the problem.)
Note that this function must create and return a new list to represent the result, and should not
rearrange or otherwise mutate the contents of the original list. This same principle should apply to
all functions that receive a list argument. In your own programs that compute some important list
that you pass to some function from the standard library, isn't life easier when you never have to
worry of that function silently mutating the contents of your list?
Expected result
items
[1, [2, 3, 4, 'yeah'], 5]
[5, ['yeah', 4, 3, 21, 1]
[[[[[[1, 2111]]]
[[[[[[2, 1]]11]]
[42, [99, [17, [33, ['bool']]]]] [[[[['boo!'], 33], 17], 991,
42]
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
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](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education