python rograming 35 Define a function reverseList that has o
python rograming 3.5
Define a function reverseList that has one parameter of type list. The list can be empty or contain values that are either float, int, or string. The function should return the list in reversed order. You must use a for or a while loop. You cannot use slicing or any built-in function or method that reverses the contents of the list. You are writing your own version of “reverse” function. Using assertEqual, verify your function with at least 3 test cases.
Solution
def myReverse(mylist): length = len(mylist) l = length rev_list = [None]*length for item in mylist: l = l - 1 rev_list[l] = item return rev_list