我希望用户输入采用字母数字格式。字母应该来自A-H
,数字应该介于两者之间1-7
例如A4
或H7
。我不希望用户输入为例如AA
,AAA
或. 这是我到目前为止所做的:2B
22
x=input("Write something:")
if len(x) !=2:
print("Wrong")
letter=x[0]
number= x[1]
if number >=8:
print("Wrong")
if letter not ["A","B","C","D","F","G"]:
print("Wrong")
if letter == int:
print("Wrong")
if number == str:
print("Wrong")
else:
print("Perfect")