write a fizzbuzz in python

Here's a simple implementation of FizzBuzz in Python:

main.py
for num in range(1, 101):
    if num % 3 == 0 and num % 5 == 0:
        print("FizzBuzz")
    elif num % 3 == 0:
        print("Fizz")
    elif num % 5 == 0:
        print("Buzz")
    else:
        print(num)
209 chars
10 lines

This code uses a for loop to iterate over the numbers from 1 to 100. For each number, it checks if it's divisible by 3 and 5, in which case it prints "FizzBuzz". If it's only divisible by 3, it prints "Fizz". If it's only divisible by 5, it prints "Buzz". If it's not divisible by either, it just prints the number itself.

gistlibby LogSnag