播种器菜鸡1号 2021-12-03 18:01 采纳率: 81.8%
浏览 68
已结题

python基础问题,用def函数

问题:编写一个名为n_w_h_output的函数,该函数接收后跟两个浮点的字符串。函数应使用以下格式打印这些参数,例如,如果用(Sam,69.7,1.9)调用函数,则函数应打印:“Sam’s weight is 69.7 and their height is 1.9”
  • 写回答

1条回答 默认 最新

  • shadowsland 2021-12-03 18:07
    关注
    
    # encoding: utf-8
    
    def n_w_h_output(name, weight, height):
        print("{}’s weight is {} and their height is {}".format(name, weight, height))
        
    
    n_w_h_output('Sam',69.7,1.9)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 12月4日
  • 已采纳回答 12月3日
  • 创建了问题 12月3日

悬赏问题

  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.