METALARISING 发表于 2023-8-28 14:36:42

钓鱼数量统计1.0


d_date1 = {'crucian carp' : , 'carp' : , 'silver carp' : }
d_date2 = {'草鱼' : , '鲫鱼' : , '黑鱼' : }
d_date3 = {'乌龟' : , '鲫鱼' : , '草鱼' : , '黄鱼' : }
fish_records = {'1.1' :d_date1, '1.2' :d_date2, '1.3' :d_date3}

d_date1['鲫鱼'] =
del(d_date3['黄鱼'])
for get_name, get_L in d_date3.items():
    get_L = get_L * 1.1
    d_date3 = get_L

nums = 0
amount = 0
day = ''
day_record = {}
for day, day_record in fish_records.items():
    print('%s 钓鱼记录为: '%(day))
    for name, sub_record in day_record.items():
      nums += sub_record
      amount += sub_record * sub_record
      print('      %s 数量%d, 单价%.2f元'%(name, sub_record, sub_record))
      print('钓鱼总数量为%d, 总金额为%.2f元'%(nums, amount))
页: [1]
查看完整版本: 钓鱼数量统计1.0