Skip to content

Instantly share code, notes, and snippets.

@Cr4ck3r
Last active March 7, 2017 03:55
Show Gist options
  • Save Cr4ck3r/320c7b02993b88dc9cdd0eb8ed89f1a5 to your computer and use it in GitHub Desktop.
Save Cr4ck3r/320c7b02993b88dc9cdd0eb8ed89f1a5 to your computer and use it in GitHub Desktop.
fizzbuzz for loop
for n in range(1,101):
if n % 3 == 0 and n % 5 == 0:
print ("fizzbuzz")
elif n % 3 == 0:
print ("fizz")
elif n % 5 == 0:
print ("buzz")
else:
print (n)
@dmsurti
Copy link

dmsurti commented Feb 27, 2017

Same as while loop version, leaving aside ¦ characters which are invalid, the code LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment