# -*- coding:utf-8 -*- # __author__ = "林深见鹿海蓝见鲸"
# ③随机20个京牌 import string import random car_list = [] begin = "京" count = 0 while count<3: # count+=1 for i in range(20): # print(i) one_number = random.choice(string.ascii_uppercase) # print(one_number) s = string.ascii_uppercase + string.digits c = random.sample(s,5) last_number = ''.join(c) # print(last_number) result = begin + one_number + last_number # print(result) car_list.append(result) print(f"随机20个车牌号{car_list}") choice = input("请输入你喜欢的车牌:") if choice in car_list: print("恭喜你选的车牌为:",choice) exit() else: print("车牌号不在范围内") print(f"还剩{2-count}次机会") count += 1