測資可能出錯,可以忽視,以下是我的搞笑版解答,有更好的可以底下回復
q= 87
while q!=0:
q=int(input())
for i in range (1,q):
if (i%7==0):
pass
elif (i==q-1):
print(str(i))
else:
print(str(i), end=" ")
測資可能出錯,可以忽視,以下是我的搞笑版解答,有更好的可以底下回復
q= 87
while q!=0:
q=int(input())
for i in range (1,q):
if (i%7==0):
pass
elif (i==q-1):
print(str(i))
else:
print(str(i), end=" ")
我是這樣寫:
n = 10000
while n !=0:
n = int(input())
arr = [ i for i in range(n) if 0 < i and (i%7) != 0 and i < n ]
print(' '.join(str(i) for i in arr))