Monday, May 22, 2023

FizzBuzz

 #!/usr/bin/python

mylist = []

for i in range(1,101):

    if i%3 == 0 and i%5 == 0 :

       mylist.append("FizzBuzz")

    elif i%3 == 0 :

      mylist.append("Fizz")

    elif i%5 == 0 :

      mylist.append("Buzz")

    else :

       mylist.append(i)

print(mylist)

No comments:

Post a Comment