In [3]:
#!/usr/bin/python3
# Nicholas Roczynski
    
def fizzbuzz(): # Main function
    
    # Your input saved as an integer of how many times you want to go for
    x = int(input("How many times would you like to go? ==> "))
    
    # The code will repeat depending on the number you inputed
    for i in range(x):
    
        # In
        num = int(input("Enter a number. ==> "))
        
        #If the number is divisable by both 3 and 5
        if (num % 3 == 0 and num % 5 == 0):
            # Fizz and Buzz combined!
            print("FizzBuzz!")
            print()
        # If the number is divisable by only 3
        elif (num % 3 == 0):
            # Just Fizz
            print("Fizz!")
            print()
        # If the number is divisable by only 5
        elif (num % 5 == 0):
            # Just Buzz
            print("Buzz!")
            print()
        # If the number isn't divisible by 3 nor 5
        else:
            # Just shows number
            print(num)
            print()
    
    # After the loop finished, the code ends.
    print("Thanks for 'Buzzing' in! ;)")
    
########## Beginning ###########
    
if __name__ == "__main__":
    print("      * FizzBuzz *     ")
    print()
    print("Press *Enter* to Begin!")
    print()
    input()
    # Go to main function
    fizzbuzz()
      * FizzBuzz *     

Press *Enter* to Begin!


How many times would you like to go? ==> 4
Enter a number. ==> 9
Fizz!

Enter a number. ==> 10
Buzz!

Enter a number. ==> 30
FizzBuzz!

Enter a number. ==> 7
7

Thanks for 'Buzzing' in! ;)

¶

In [ ]: