## Fizzbuzz

Report
Question

### Please briefly explain why you feel this question should be reported .

# you can write to stderr for debugging purposes, e.g.
# sys.stderr.write(“this is a debug message\n”)

def solution(N):
for x in range(1000):
if x % 3 == 0 and x % 5 == 0 and x % 7 == 0:
print(“FizzBuzzWoof”);
continue
elif x % 3 == 0 and x % 5 == 0:
print(“FizzBuzz”);
elif x % 3 == 0 and x % 7 == 0:
print(“FizzBuzz”);
elif x % 5 == 0 and x % 7 == 0:
print(“FizzWoof”);
elif x % 3 == 0:
print(“Fizz”);
elif FizzBuzz % 5 == 0:
print(“Buzz”);
else x % 5 == 0:
print(“Woof”);
print(x)

error

Example test:   24
Output (stderr):

Traceback (most recent call last):
File “exec.py”, line 102, in <module>
main()
File “exec.py”, line 61, in main
sol = __import__(‘solution’)
File “/tmp/solution.py”, line 9
elif x % 3 == 0 and x % 5 == 0:
^
SyntaxError: invalid syntax

RUNTIME ERROR (tested program terminated unexpectedly)

in progress 0
Python 6 months 2 Answer 2032 views 0

## Answers ( 2 )

1. ### Please briefly explain why you feel this answer should be reported .

This is a Python program which iterates the integers from 1 to 50. For multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

```for fizzbuzz in range(50):
if fizzbuzz % 3 == 0 and fizzbuzz % 5 == 0:
print("fizzbuzz")
continue
elif fizzbuzz % 3 == 0:
print("fizz")
continue
elif fizzbuzz % 5 == 0:
print("buzz")
continue
print(fizzbuzz)
```
2. ### Please briefly explain why you feel this answer should be reported .

You really don’t need all those comparisons, try building the output progressively!
Add your “Woof” to this piece of code! =)

```for fizzBuzzer in range(1, 51):
verse = ""
if (fizzBuzzer % 3 == 0):
verse += "Fizz"
if (fizzBuzzer % 5 == 0):
verse += "Buzz"
if (verse == ""):
print(fizzBuzzer)
continue
print (verse)
```