Question
In Python 3.5 or newest release Imagine that the most of the functions that we have been using to process lists in Python do not
In Python 3.5 or newest release
Imagine that the most of the functions that we have been using to process lists in Python do not exist. For the problems below you are not allowed to use any list methods (append, remove, insert, etc) or certain core Python functions specified in each problem. You may, however, use your own custom-written functions to solve these problems (i.e. if you find that your listlen() function would be useful in writing another function you are welcome to use it). Given these restrictions, write a series of functions that do the following:
7. Write a new function called "listreverse" based on the following IPO
# function: listreverse # INPUT: a list # PROCESSING: creates a copy of the supplied list that # contains the same elements as the original # list, but in reverse order # OUTPUT: return a new copy of the list in reverse order
Make sure that you DO NOT use any list methods such as "reverse" your program. Note that your original list should not change when you run this function. Here is a sample running of this program:
mylist = [10, 20, 30] x = listreverse(mylist) print (x) print (mylist) >> [30, 20, 10] >> [10, 20, 30]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started