import random
import string
count=0
while count<3:
car_num=[]
for i in range(1,21):
n1=random.choice(string.ascii_uppercase)
n2="".join(random.sample(string.ascii_uppercase+string.digits,5))
c_num=f"京{n1}-{n2}"
car_num.append(c_num)
print(car_num)
choice=input("你选择的车牌号:").strip()
if choice in car_num:
exit("Good luck!")
else:
count+=1
[‘京D-XRF5N’, ‘京Y-5KP4M’, ‘京W-QSMNZ’, ‘京K-SC5FW’, ‘京C-MLZ2S’, ‘京V-EB4XD’, ‘京J-AJDQ5’, ‘京G-G724W’, ‘京H-4VSR7’, ‘京P-DMIAC’, ‘京D-GF1CO’, ‘京X-O954W’, ‘京G-KPIR6’, ‘京I-2OE4L’, ‘京F-WHNXB’, ‘京W-T7MN1’, ‘京W-G7QR6’, ‘京V-WKFZ8’, ‘京J-FLBT9’, ‘京U-Q1R5P’]
你选择的车牌号:没有
[‘京Y-IY7GK’, ‘京U-5E1O7’, ‘京Q-TL8Z7’, ‘京U-AXI5G’, ‘京W-UR59Q’, ‘京M-YCVON’, ‘京B-8D09U’, ‘京E-C7OXF’, ‘京K-KOFJQ’, ‘京D-9I6U7’, ‘京X-FRIMQ’, ‘京C-HGUJ5’, ‘京D-DN3KF’, ‘京X-0NWLR’, ‘京S-SWGEC’, ‘京H-DV8SR’, ‘京X-NYF7B’, ‘京Z-EM9B1’, ‘京T-42JHL’, ‘京O-9TXK6’]
你选择的车牌号:京Q-TL8Z7
Good luck!