【问题标题】:How can I Get My Custom Function to Execute Correctly?如何让我的自定义函数正确执行?
【发布时间】:2023-02-22 23:19:29
【问题描述】:

enter image description here

我只是在效法我老师的榜样。她在身体里加了那个 f。我删除了它,但仍然得到相同的结果。当我运行它时,我的名字应该出现,而不是 (name) 出现。

【问题讨论】:

标签: python string function printf user-defined-functions


【解决方案1】:

您需要使用大括号 { } 而不是 ( )

def say_hello(name):
    print(f"Hello, {name}!")

say_hello("Roxy")

【讨论】:

  • 谢谢你一百万!
猜你喜欢
  • 2021-02-15
  • 1970-01-01
  • 1970-01-01
  • 2012-09-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-07-27
  • 1970-01-01
相关资源
最近更新 更多