0
Ich mache eine Funktion, die nach einer neuen Eingabe fragt, bis sie entweder Zahlen 0-8 oder 'X' erhält. Bisher habe ich das gemacht, aber es funktioniert nicht. Ich weiß, warum es nicht funktioniert, aber ich weiß nicht, wie es funktioniert.Make-Funktion akzeptieren 0-9 und X
def get_computer_choice_result(computer_square_choice):
print('What is hidden beneath square', computer_square_choice, '? (0 - 8 -> number of surrounding mines or X)')
field_content = input()
while not (ord(field_content) > ord('0') and ord(field_content) < ord('8')) or field_content != 'X':
field_content = input('Invalid input.Please enter either 0 - 8 -> number of surrounding mines, or X -> a mine.')
return field_content