我想请教以下问题:
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/