Question: In this assignment we will code using a list. We will generate a list of 20 numbers using the random number generator. Next we need
In this assignment we will code using a list. We will generate a list of 20 numbers using the random number generator. Next we need to write code for a new function called reverse. (Please note, Python has a built in function to perform this task - we are not using that - we are coding a version of it ourselves).
This new function, reverse, creates another list in which the sequence of all the items is reversed.
Use pseudo code. Walk thru this to make sure it will work. The pseudo code will be entered as comments at the start of your Python code. (5 points).
- Lastly, we will write the code, and execute it (10 points). Make sure the code is well annotated with comments (5 points).
- The output should be the two lists and the big-O complexity of your code (if this is done, it is worth an extra 2 points, if it is not done 2 points will be deducted - this amounts to a 4 point penalty).
Note Again: Python lists have a built in method called reverse - we will not use this method - instead we are defining our own method.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
