Advertisement
jimMoonrock

Tik Tok

Mar 25th, 2021 (edited)
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.05 KB | None | 0 0
  1. a = [[0 for _ in range(3)]for i in range(2)]
  2.  
  3. len_a, count = 0, 0
  4.  
  5. for lists in a:
  6.     for elenents_in_list in lists:
  7.         len_a += 1
  8.  
  9. while count < len_a:
  10.  
  11.     print("Please  enter 3 numbers x, y and number with space and press enter")
  12.  
  13.     try:
  14.         user_1 = list(map(int, input("user_1 enter x, y and number: ").split()))
  15.         user_2 = list(map(int, input("user_2 enter x, y and number: ").split()))
  16.         if a[user_1[0]][user_1[1]] == 0:
  17.             a[user_1[0]][user_1[1]] = user_1[2]
  18.             count += 1
  19.             print(a)
  20.         else:
  21.             print(f"Try again another coord user1 - x: {user_1[0]} and y:{user_1[1]}, this coord already used")
  22.  
  23.         if a[user_2[0]][user_2[1]] == 0:
  24.             a[user_2[0]][user_2[1]] = user_2[2]
  25.             count += 1
  26.             print(a)
  27.         else:
  28.             print(f"Try again another coord user2 - x: {user_2[0]} and y:{user_2[1]}, this coord already used")
  29.  
  30.     except IndexError:
  31.         print("Try another index x: 0-2 and y: 0-2 ")
  32.         continue
  33.     print(count)
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement