fork download
  1. import numpy as np
  2.  
  3.  
  4. def get_fliplr(xs):
  5. xs = np.array(xs)
  6. if xs.ndim == 1:
  7. return np.flipud(xs)
  8. return np.fliplr(xs)
  9.  
  10. res = get_fliplr([3, 1, 4])
  11. print(res)
  12. res = get_fliplr([[3, 1, 4], [1, 5, 9]])
  13. print(res)
  14.  
Success #stdin #stdout 0.12s 24844KB
stdin
Standard input is empty
stdout
[4 1 3]
[[4 1 3]
 [9 5 1]]