mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Add fizzbuzz snippet to tests
This commit is contained in:
14
tests/snippets/fizzbuzz.py
Normal file
14
tests/snippets/fizzbuzz.py
Normal file
@@ -0,0 +1,14 @@
|
||||
def fizzbuzz(n):
|
||||
if n % 3 == 0 and n % 5 == 0:
|
||||
return "FizzBuzz"
|
||||
elif n % 3 == 0:
|
||||
return "Fizz"
|
||||
elif n % 5 == 0:
|
||||
return "Buzz"
|
||||
else:
|
||||
return str(n)
|
||||
|
||||
n = 1
|
||||
while n < 10:
|
||||
print(fizzbuzz(n))
|
||||
n += 1
|
||||
Reference in New Issue
Block a user