mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Add fizzbuzz snippet to tests
This commit is contained in:
1 parent
cd940f13ba
commit
8b4549efbe
1 file changed
+14
@@ -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