Official
A - Fizz Editorial by en_translator
If you are new to learning programming and do not know where to start, please try Problem A “Welcome to AtCoder” from practice contest. There you can find a sample code for each language.
Also, if you are not familiar with problems in programming contests, we recommend you to try some problems in “AtCoder Beginners Selection” (https://atcoder.jp/contests/abs).
Use a for statement to print \(N\) lines.
Just as instructed by the problem statement, for each \(k=1,2,\ldots,N\) in order, print Fizz if \(k\) is a multiple of \(3\), and \(k\) if it is not.
n = int(input())
for k in range(1, n + 1):
if k % 3 == 0:
print("Fizz")
else:
print(k)
posted:
last update: