python - generate a coordinate system with 2 numbers -
The user gives me 2 numbers and I want to get 2 numbers and generate a grid with coordinates. For example, the user gives me 4 for the first number and 3 for the second, now I have 4 by 3 grids. I will generate a coordinate system, so that if I want, I take coordinate (2,2) I can compare it with another coordinate (1,1). If I'm just starting, I'm learning the statement, so I do not want to use any strange or high level programming. Thanks!
Do you mean something like this:
def cum (n , M): AMM (Range (N)) in Print (Spider) X for 'Matrix:% s X% s'% (N, M) IND: print zip ([Ind * * N, ALM] [(4,5), (5,4), (5,5)]: co (i [0], i [1]) Output: < Pre> Matrix: 4x5 [(0, 0), (0, 1), (0, 2), (0, 3)] [(1, 0), (1, 1), (1 , 2), (1, 3)] [(2, 0), (2, 1), (2, 2), (2, 3)] [(3, 0), (3, 1), (3 , (2,), (3, 3)] [(4, 0), (4, 1), (4, 2), (4, 3)] matrix: 5 x 4 [(0, 0), (0, 1), (0, 2), (0, 3), (0, 4)] [(1, 0), (1, 1), (1, 2), (1, 3), (1, 4 )] [(2, 0), (2, 1), (2, 2), (2, 3), (2, 4)] [(3, 0), (3, 1), (3, 2), (3, 3), (3, 4)] matrix: 5 x 5 [(0, 0), ( 0, 1), (0, 2), (0, 3) (0, 4)] [(1, 0), (1, 1), (1, 2), (1, 3), (1, 4)] [(2, 0), (2, 1) (2, 2), (2, 3), (2, 4)] [(3, 0), (3, 1), (3, 2 ), (3, 3), (3, 4)] [(4, 0), (4, 1), (4, 2), (4, 3), (4, 4)] / Pre>
Comments
Post a Comment