萌王669 2022-11-30 22:30 采纳率: 100%
浏览 61
已结题

求解答,急,本人真的是没有办法了

img


本人可能没有学习Python的天赋,想半天也不能达到完美,仅需要第二问,比较基础的一个程序,请高抬贵手,解答完美可追加赏金
12月1日12:00截止哦

  • 写回答

5条回答 默认 最新

  • 阿_旭 2022-11-30 23:21
    关注

    img

    
    # 1
    
    rabis = []
    for i in range(2):
        rabi = input(f'请输入第{i+1}只兔子的名字:')
        rabis.append(rabi)
    print(f"My rabbits' name are {rabis[0]} and {rabis[1]}")
    fish = {}
    count = input(f'请输入你有几条红色的鱼:')
    fish['red'] = int(count)
    count = input(f'请输入你有几条蓝色的鱼:')
    fish['blue'] = int(count)
    print(f'I have {fish["red"]} red finish and {fish["blue"]} blue fish.')
    
    
    # 2
    def pet(food1,food2,food3=None):
        if food3 != 'water':
            print('I need some water for pets')
        else:
            food = ['carrot' , 'vegetable' , 'water']
            print("There are3 kind of food for pet, the food list is:")
            print("------ {}".format(food1))
            print("------ {}".format(food2))
            print("------ {}".format(food3))
            return(food)
    
    pet('carrot' , 'vegetable')
    pet('carrot' , 'vegetable' , 'water')
    
    # 3
    food_label = {'food1':'carrot',"food2":'vegetable','food3':'water'}
    food_label['food1'] = 'grass'
    food_label['food4'] = 'snack'
    
    for i, name in food_label.items():
        print('{} is {}'.format(i , name))
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(4条)

报告相同问题?

问题事件

  • 系统已结题 12月9日
  • 已采纳回答 12月1日
  • 修改了问题 12月1日
  • 修改了问题 11月30日
  • 展开全部

悬赏问题

  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题