Menu

Sign in to track your progress and unlock all features.

Theme style

Log in

Full lesson preview

Return FizzBuzz Value

Return the classic FizzBuzz response for a given integer using if/elif/else logic.

Python practice18 minControl Flow (If–Else Logic)IntermediateLast updated March 15, 2026

Problem statement

Write a function fizzbuzz(n) that returns: - 'FizzBuzz' if n is divisible by both 3 and 5. - 'Fizz' if n is divisible by 3 only. - 'Buzz' if n is divisible by 5 only. - Otherwise, return the string representation of n. Make sure the check for divisibility by both 3 and 5 happens before the individual checks.

Task

Practice ordering of conditional checks (especially for multiples of both 3 and 5) and returning strings.

Examples

Divisible by 3

Input

fizzbuzz(9)

Output

Fizz

9 is divisible by 3 so return 'Fizz'.

Input format

An integer n passed to fizzbuzz(n).

Output format

A string: 'Fizz', 'Buzz', 'FizzBuzz', or the string form of n.

Constraints

n is an integer (can be zero or negative).

Samples

Sample 1

Input

fizzbuzz(5)

Output

Buzz

5 is divisible by 5.