Sponsored Reserved space — layout preview until AdSense is connected
easy +10 pts

FizzBuzz, precisely

Control flow meets string discipline.

Implement `fizzbuzz(n: int) -> str`. Return a single string joined with newlines covering `1..n` inclusive. - Multiples of 3 → `"Fizz"` - Multiples of 5 → `"Buzz"` - Multiples of both → `"FizzBuzz"` - Otherwise → the number as a string

Constraints

1 ≤ n ≤ 5000. No side-effects — return the string.

Example

>>> fizzbuzz(5)
"1\n2\nFizz\n4\nBuzz"
10 points ~12 min

Recent Submissions

No submissions yet — hit Run Tests to try!

Hints

Iterate with range(1, n+1) and collect lines into a list.
Check divisible-by-15 first.
Python 3
All tests passed!
Test Results
Press Ctrl+Enter or click Run Tests to execute your code.
Sponsored Reserved space — layout preview until AdSense is connected