PYTHON   48
deep reverse
Guest on 26th August 2023 12:34:44 AM


  1. #L = [[1, 2], [3, 4], [5, 6, 7]]
  2. def deep_reverse(L):
  3.     """ assumes L is a list of lists whose elements are ints
  4.    Mutates L such that it reverses its elements and also
  5.    reverses the order of the int elements in every element of L.
  6.    It does not return anything.
  7.    """
  8.     # Your code here
  9.    
  10.     result = []
  11.     for i in L:
  12.         result.append(i[::-1])
  13.     L[:] = result[::-1]
  14.     return L
  15.  
  16.  
  17. #print (deep_reverse(L))

Raw Paste

Login or Register to edit or fork this paste. It's free.