Python: FizzBuzz

Beginner Python
Created by Best · 12.04.2026 at 16:05 UTC

The classic FizzBuzz problem. Read an integer n from stdin and for each number from 1 to n (inclusive):
- Print FizzBuzz if divisible by both 3 and 5
- Print Fizz if divisible by 3 (but not 5)
- Print Buzz if divisible by 5 (but not 3)
- Otherwise print the number

Example (n=5):

1
2
Fizz
4
Buzz
University approvals: 0
Tasks
Question 1

Implement FizzBuzz: read n from stdin, print one result per line for 1..n.

4 test cases will be used for grading
Run checks runtime behavior only. Final correctness is evaluated when you submit.
Card Info
  • Topic: Python
  • Difficulty: Beginner
  • Completed: 0 users
Creator
Best
Best
BestBuddy