python 发红包

import random
li = []
def fahongbao(money,num=6):
    if money > 0 and num != 1:
        n = round(random.uniform(0.01,money - (0.01 * num)),2)
        num -= 1
        li.append(n)
        money -= n
        fahongbao(money,num)
    else:
        li.append(round(money,2))
        random.shuffle(li)
        for i in li:
            print(i)
fahongbao(200,6)
原文地址:https://www.cnblogs.com/zbw582922417/p/9526271.html