<p>这是一个由三部分组成的问题,我对。。。。在</p>
<ol>
<li><p>我的输出没有给我输入整数的选项,它在下一行打印“none”并跳过该选项</p></li>
<li><p>结束文件触发器工作不正常</p></li>
<li><p>计算我为之记录数据的玩家……我真的不知道从哪里开始计算输入数据</p></li>
</ol>
<p>---------------我的输出----------------------
你将被要求输入球员的名字和分数
如果没有其他名称,请输入End</p>
<p>输入玩家姓名或结束退出程序:Randy
输入Randy的高尔夫得分:
无
------------------我的输出端------------------</p>
<h2>我的代码</h2>
<pre><code>def main():
#introduction to user explaining required information to be entered
print("You will be asked to enter players names and scores")
print("When you have no more names, enter End")
#double blank space
print("\n")
#defined y/n
anotherPlayer = "y"
#define file path to save user input
usersFile = open('golf.txt', 'w')
#
while anotherPlayer == "y":
playerName = input("Enter Player's Name or End to exit program: ")
score = int(input(print("Enter", playerName, "'s golf score: ")))
usersFile.write(playerName + "," + str(score) + "\n")
anotherPlayer = input("Is there another player? y / End: ")
End = usersFile.close()
main()
</code></pre>
<p>------------结束我的代码----------------</p>
<p>我需要它说</p>
<p>-----------需要分配输出----------------</p>
<p>你将被要求输入球员的名字和分数
如果没有其他名称,请输入End</p>
<p>输入玩家姓名或结束退出程序:Randy
输入Randy的高尔夫得分:50</p>
<p>输入玩家姓名或结束退出程序:结束
您已将1个玩家记录写入高尔夫.txt在</p>
<p>-----------结束分配输出-----------------</p>