Skip to content

Instantly share code, notes, and snippets.

@AstragoDE
Last active July 30, 2023 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AstragoDE/8f495bc36ace45314773baac7cf38553 to your computer and use it in GitHub Desktop.
Save AstragoDE/8f495bc36ace45314773baac7cf38553 to your computer and use it in GitHub Desktop.
for i in range(1, 101):
# `and`-Bedingung hinzugefügt, damit "Fizz" **Ausschließlich** bei `i % 3 == 0` ausgegeben wird.
if i % 3 == 0 and i % 5 > 0:
print("Fizz")
# `and`-Bedingung hinzugefügt, damit "Buzz" **Ausschließlich** bei `i % 5 == 0` ausgegeben wird.
if i % 5 == 0 and i % 3 > 0:
print("Buzz")
if i % 5 == 0 and i % 3 == 0:
print("FizzBuzz")
# `<=` durch `>=` ersetzt, damit die Zahlen, die nicht durch 3 oder 5 teilbar sind, ausgegeben werden.
if i % 3 >= 1 and i % 5 >= 1:
print(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment