gpt4 book ai didi

python-3.x - python : How to call a variable in an input prompt?

转载 作者:行者123 更新时间:2023-12-05 08:56:10 24 4
gpt4 key购买 nike

我想请教以下问题:

What is the team name?

How many points did (team_name) score?

我已经试过了,但返回了一个错误:

team_name = input("What is the team name? ")

points = input("How many points did", team_name, "score? ")

请帮忙!

最佳答案

这是执行此操作的 python3.6 方法:

points = input(f"How many points did {team_name} score?")

关于python-3.x - python : How to call a variable in an input prompt?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42104584/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com