z=list()
t=raw_input()
for i in range (0,int(t)):
x= raw_input()
z.append(x)
for i in z:
if(i%3==0 and i%5==0):
print 'FizzBuzz'
elif(i%3==0):
print 'Fizz'
elif(i%5==0):
print 'Buzz'
else:
print i
print '\n'
这是我的代码。出于某种原因,我不断收到此错误
Traceback(最近一次调用最后一次):文件 “/tmp/editor_trsource_1390938776_887424.py”,第10行,中
x = raw_input()EOFError:读取行时的EOF
答案 0 :(得分:0)
z.append(x)
应为z += [int(x)]
:您需要在检查字符串的可分性之前将字符串转换为整数。
z=list()
t=raw_input()
for i in range (0,int(t)):
x= raw_input()
z += [int(x)]
for i in z:
if(i%3==0 and i%5==0):
print 'FizzBuzz'
elif(i%3==0):
print 'Fizz'
elif(i%5==0):
print 'Buzz'
else:
print i
print '\n'