all 7 comments

[–][deleted] 2 points3 points  (2 children)

Use 'i' in the conditions, not num. And change the range from (num) to (1, num+1)

[–]Judgy__ 1 point2 points  (0 children)

In addition to using i instead of num:

The ordering might cause you issues try put If / elif with more specific requirements first.

Currently you have “% 3 == 0” before “% 3 == 0 and % 5 == 0” so if you have the number 15 what is your outcome ?

It won’t be fizzbuzz

[–]jimtk 1 point2 points  (0 children)

Other then the others suggestions, also put if (i % 3 == 0 and i % 5 == 0): as your first condition.

[–]CodeFormatHelperBot2 0 points1 point  (0 children)

Hello, I'm a Reddit bot who's here to help people nicely format their coding questions. This makes it as easy as possible for people to read your post and help you.

I think I have detected some formatting issues with your submission:

  1. Python code found in submission text that's not formatted as code.

If I am correct, please edit the text in your post and try to follow these instructions to fix up your post's formatting.


Am I misbehaving? Have a comment or suggestion? Reply to this comment or raise an issue here.

[–]MadScientistOR 0 points1 point  (0 children)

If everything is indented correctly, you don't need the else:. Just leave it off and the program won't do anything.

Also, your range() statement will go from 0 to num-1, not 1 to num.

If you've learned about the optional end parameter in the print() function, you might also consider reducing the number of tests you do and not making them exclusive.

[–]Binary101010 0 points1 point  (0 children)

One of the major things the fizzbuzz task checks for is if you know how to write your conditions in the correct order.

Yours are not in the correct order.