python关于人名的问题有人看看吗

预先准备好一些汉字,然后根据这些汉字随机生成50个人名,要求其中大概75%左右的人名是3个字的,20%左右的人名是2个字的,5%左右的人名是4个字的。程序运行后,在屏幕上输出这些人名

按75%,20%,5%的比例生成一个包括2,3,4的数列
然后随机打乱,再随机取出其中50个组成新的数列。
此时,75%,20%,5%这些比例是“大概”的
然后在汉字字串中随机取出2~4个组成名字

import random

n = [4]*5+[2]*20+[3]*75
random.shuffle(n)
n = random.sample(n,50)

s = '赵钱孙李周吴郑王冯陈褚卫蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚谢邹喻柏水窦章云苏潘葛奚范彭郎'

for i in n:
    print(''.join(random.sample(s,i)))

望采纳(;´д`)ゞ


import random
import math

list1 = []#这里填预备的字
n1 = len(list1)
temp = ""
list2 = []
for i in range(math.floor(50/100*75)):
    temp = ""
    for j in range(3):
        temp += list1[random.randint(0,n1-1)]
    list2.append(temp)
for b in range(math.floor(50/100*20)):
    temp = ""
    for a in range(2):
        temp += list1[random.randint(0, n1-1)]
    list2.append(temp)
for c in range(math.floor(50/100*5)):
    temp = ""
    for d in range(4):
        temp += list1[random.randint(0,n1-1)]
    list2.append(temp)
print(list2)