This is not full code, but the question is in coordinates. The first time you type coords, code just ignore them, but if you type the same coords second time, code will work properly. Help please
b = input()
coords = b.split()
coordinates_x = int(coords[0])
coordinates_y = int(coords[1])
new_list = [x for x in a]
for i in range(3):
line_1.append(new_list[i])
line_2.append(new_list[i + 3])
line_3.append(new_list[i + 6])
# залупа ебаная
while True:
b = input()
coords = b.split()
coordinates_x = int(coords[0])
coordinates_y = int(coords[1])
if (3 >= coordinates_y >= 1) and (3 >= coordinates_x >= 1):
if coordinates_x == 1:
if new_list[coordinates_y - 1] == "_":
new_list[coordinates_y - 1] = "X"
pechat(new_list)
break
elif new_list[coordinates_y - 1] == "X" or new_list[coordinates_y - 1] == "0":
print("This cell is occupied! Choose another one!")
continue
elif coordinates_x == 2:
if new_list[coordinates_y + 2] == "_":
new_list[coordinates_y + 2] = "X"
pechat(new_list)
break
elif new_list[coordinates_y + 2] == "X" or new_list[coordinates_y + 2] == "O":
print("This cell is occupied! Choose another one!")
continue
elif coordinates_x == 3:
if new_list[coordinates_y + 5] == "_":
new_list[coordinates_y + 5] = "X"
pechat(new_list)
break
elif new_list[coordinates_y + 5] == "X" or new_list[coordinates_y + 5] == "O":
print("This cell is occupied! Choose another one!")
continue
elif (3 < coordinates_y or coordinates_y < 1) or (3 < coordinates_x or coordinates_x < 1):
print("Coordinates should be from 1 to 3!")
>Solution :
Those first four lines:
b = input()
coords = b.split()
coordinates_x = int(coords[0])
coordinates_y = int(coords[1])
just take input and do nothing with it. That’s why the first coords you enter don’t do anything. Just remove those lines and it should work.
The code inside the while loop takes the input and actually runs the calculations on it, so you must leave it in place. The 4 at the top look like leftovers from an earlier version of the program before the while loop.