FizzBuzz Rules

FizzBuzz is a classic way to practice conditions, especially the order of checks. The function fizzbuzz receives a number n and returns FizzBuzz if it is divisible by 15, Fizz if it is divisible by 3, and Buzz if it is divisible by 5. If none of these rules match, return the number itself as a string.

Примеры

Ввод
15
Вывод
"FizzBuzz"
Ввод
3
Вывод
"Fizz"
Ввод
5
Вывод
"Buzz"

Нужно реализовать

def fizzbuzz(n: int) -> str:

Теги

mathstrings
PostgreSQLv16

Le résultat de l'exécution du code s'affichera ici

Visible tests
1
Input
15
Expected"FizzBuzz"
2
Input
3
Expected"Fizz"
3
Input
5
Expected"Buzz"
4
Input
7
Expected"7"
5
Input
30
Expected"FizzBuzz"
6
Input
-100
Expected"Buzz"
Focus radio
Paused · SomaFM · Fluid