CodeDrill
day_streak: --
← 問題一覧に戻る
Python ・ Standard I/O

Problem 32: FizzBuzz

An integer N is given on a single line from standard input. For each integer from 1 to N, output one per line according to the following rules.

・If divisible by both 3 and 5: FizzBuzz
・If divisible by 3: Fizz
・If divisible by 5: Buzz
・Otherwise, the number itself

Constraints

1 ≤ N ≤ 100

Input example 1

5

Output example 1

1
2
Fizz
4
Buzz

Input example 2

3

Output example 2

1
2
Fizz

What you'll train

State the constraints

What you get

  • Indicate the priority of conditions
  • Specify the order of the branches
  • Check boundary values

How to ask the AI

Tell the AI that when a number is divisible by both 3 and 5, FizzBuzz should take priority—in other words, that the order in which conditions are checked matters. It's also reassuring to confirm that even a small value like N=1 produces the correct single-line output.

If you ask vaguelyIf you don't specify the order of the checks, the AI may process the multiple-of-3 condition first, resulting in code that never outputs FizzBuzz.

あなたのコード

実行しました

プレビュー

AIレビュー(プロンプト練習)

コードはChatGPTやClaudeに出させたものを貼って構いません。
ここでの本番は「次にAIへ出す指示」です。評価軸は1つだけ見て、弱点・指示の穴・改善例を返します。
テストに落ちていてもレビューできます。落ちた理由と、指示に足りなかった情報を結びつけます。

先にコードを実行し、テストを1つ以上通してください。