Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In python Implement following functions: reverse_to_new_list (lst) - This function creates a new list containing the elements of 1st in reverse order and returns it.

In pythonimage text in transcribed

Implement following functions: reverse_to_new_list (lst) - This function creates a new list containing the elements of 1st in reverse order and returns it. reverse_in_place (lst)- When called, this function changes the order of the elements in lst (in place) to be in the reverse order. Hint:think about the how the positions change before and after the reverse. 1. 2. You may use the following main program to check your implementation of reverse_to_new_list and reverse in place def mainO lstl-[, 2, 3, 4, 5, 6] rev1st1 = reversetonewlist(1st1) print ("After reverse_to_new_list, 1st1 is", 1st1 - - - - "and the returned list is", rev lst1) 1st2 [1, 2, 3, 4, 5, 6 print ("Before reverse in place, 1st2 is", 1st2) reverse_in_place (lst2) print ("After reverse_in_place, lst2 is", 1st2) Expect output: After reverse_to_new_list, lstl is [1, 2, 3, 4, 5, 6] and the returned list is [6, 5, 4, 3, 2, 1] Before reverse_in_place, lst2 is [1, 2, 3, 4, 5, 6] After reverse_in_place, 1st2 is [6, 5, 4, 3,2,1]

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

Database Publishing With Filemaker Pro On The Web

Authors: Maria Langer

1st Edition

0201696657, 978-0201696653

More Books

Students also viewed these Databases questions

Question

Did you organize your thoughts and make a Table of Contents?

Answered: 1 week ago