+ 1
How to write a python program on matrix flip?
Write a Python function matrixflip(m,d) that takes as input a two dimensional matrix m and a direction d, where d is either 'h' or 'v'. If d == 'h', the function should return the matrix flipped horizontally. If d == 'v', the function should retun the matrix flipped vertically. For any other value of d, the function should return munchanged. In all cases, the argument m
2 Answers
+ 5
[[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
V:
[[7, 8, 9],
[4, 5, 6],
[1, 2, 3]]
H:
[[3, 2, 1],
[6, 5, 4],
[9, 8, 7]]
Right?
+ 4
https://code.sololearn.com/cV25twsI06ND/?ref=app
If that's how it works, here is the code.