当我读this
有这个密码的
We can also do that this way:
We'd have 500000 beans, 500 jars, and 5 crates.
当我改成政治公众人物498的时候
print ("We can also do that this way:")
print (f"We'd have {secret_formula(start_point)} beans, {secret_formula(start_point)} jars, and {secret_formula(start_point)} crates.")
它打印这个
We can also do that this way:
We'd have (500000, 500, 5) beans, (500000, 500, 5) jars, and (500000, 500, 5) crates.
我看到你正在遵循
LPTHW
教程,我strongly
建议你选择一个不同的教程,因为你现在的教程有一些非常有趣的意见和some other issues。你知道吗回到您的问题:您需要将
secret_formula()
调用解包为:f-strings
基本上只是把变量放在字符串中调用它,因为secret_formula()
返回一个元组,当你只是调用函数时,它会返回并打印元组。你知道吗我想把这段代码改成f-string
print "We can also do that this way:" print "We'd have %d beans, %d jars, and %d crates." % secret_formula(start_point)
相关问题 更多 >
编程相关推荐