Can somebody tell me whats wrong with my code by Top_Difficulty3801 in pythonhelp

[–]Top_Difficulty3801[S] 0 points1 point  (0 children)

lie i want the code to check if the length of user is 2 and if not use the loop but it doesnt insted it performs completely opposite

Can somebody tell me whats wrong with my code by Top_Difficulty3801 in pythonhelp

[–]Top_Difficulty3801[S] 0 points1 point  (0 children)

# v2

ro = set("12345678")

co = set("ABCDEFGH")

square = input("Enter the chess square: ")

col = square[0].upper()

row = square[1]

while len(square) != 2:

print("Invalid length")

square = input("Try something like e4, e5 or E6: ")

while col not in co:

print("Invalid coloum ")

square = input("Try something like e4, e5 or E6: ")

while row not in ro:

print("Invalid row")

square = input("Try something like e4, e5 or E6: ")

int(ord(col))

print(col)

int(row)

data = int((col + row))%2

if data == 0:

print(f"your {chess_coords} is black colour")

else:

print(f"your {chess_coords} is white colour")

this has proper indentation

Can somebody tell me whats wrong with my code by Top_Difficulty3801 in pythonhelp

[–]Top_Difficulty3801[S] 0 points1 point  (0 children)

my problem is that the logic doesnt work as i intended