mailroom_new.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:IntroPython2016 作者: UWPCE-PythonCert 项目源码 文件源码
def donation_list():
    # establish separate dictionary objects #
    results = collections.OrderedDict()
    donor_dict = {"Donors": []}
    totals_dict = {"Total $": []}
    # loop through donors data set and perform aggregate functions #
    for donor, donations in sorted(donors.items()):
        donor_dict["Donors"].append(donor)
        totals_dict["Total $"].append((sum(donations)))
    # combine dictionary objects into one for tabulate data input format #
    results.update(donor_dict)
    results.update(totals_dict)
    print(tabulate(results, headers="keys", tablefmt="fancy_grid", numalign="center"))


# Add donor name to list #
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号