Meszias

print the princess

Jul 15th, 2020
1,192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. from __future__ import print_function
  2.  
  3.  
  4. my_matrix = [[0, 0, 0, 0],
  5.              [0, 0, 0, 0],
  6.              [0, 0, 0, 0], ]  # to create 4x4 matrix
  7.  
  8. def print_matrix(matrix):
  9.     for row in matrix:
  10.         for col in row:
  11.             # end=' ' to avoid the print command create new line on every line
  12.                 print(col, end=' ')
  13.         print() # for new line
  14.  
  15.  
  16. def enter_princess_position():
  17.     x, y = map(int, input('Princess position:').split(';'))
  18.     my_matrix[x][y] = 'P'
  19.     print_matrix(my_matrix)
  20.  
  21.  
  22. enter_princess_position()
Advertisement
Add Comment
Please, Sign In to add comment