跟书友汇德天一起选车牌号吧!
程序员文章站
2022-05-02 12:53:38
...
拥有一辆自己的汽车是一个幸福时刻,然后为爱车选一个好的车牌也是众多车迷一定要做的功课,接下来,让我们一起行动吧!
内容简单大家简单了解一下吧!
import random
import string
count = 0
your_ch = []
while count < 3:
car_nums = []
for i in range(20):
n1 = random.choice(string.ascii_uppercase)
n2 = "".join(random.sample(string.ascii_uppercase + string.digits, 5))
car_num = f"京{n1}-{n2}"
car_nums.append(car_num)
print(car_num)
choice = input("输入你喜欢的车牌:")
count += 1
if choice in car_nums:
your_ch.append(choice)
print(f"恭喜你选择了新车牌号:{choice}")
else:
print("非法选择")
print(f"您选择的车牌号如下:{your_ch}")