我正在开展CodeEval的FIZZ BUZZ挑战,这里是链接:https://www.codeeval.com/open_challenges/1/submit/?lid=1218578
这是我的代码:
"""Sample code to read in test cases:
import sys
test_cases = open(sys.argv[1], 'r')
for test in test_cases:
# ignore test if it is an empty line
# 'test' represents the test case, do something with it
# ...
# ...
test = test.strip()
X, Y, N = (int(s) for s in test.split())
result = ""
for i in range(1, N+1):
if i % X == 0 and i % Y == 0:
result += "FB "
elif i % X == 0:
result += "F "
elif i % Y == 0:
result += "B "
else:
result += str(i) + " "
print (result.strip())
test_cases.close()
"""
但是,根据CodeEval没有输出。有什么问题?
答案 0 :(得分:0)
在网站上查看后,您似乎用三重报价包围了所有代码,这与评论相同。我相应地纠正了这个问题。只需删除三重报价,一切都应该正常工作