Repeating an algorithm as many times as the user requires (PYTHON 3.3.2 GUI)
Question: I'm trying to repeat this algorithm and use the values in my code, please
help!!!

import random

    
    
    def dice_roll(number):
        if number == 12:
            number = random.randint(1,12)
            print(number)
            return(number)
        elif number == 6:
             number = random.randint(1,12)
             print(number)
             return(number)
        else:
            number == 4
            number = random.randint(1,12)
            print(number)
            return(number)
    

dice_roll(int(input("Which dice would you like to roll? --> ")))


Answer: The typical way to do this is a `while True` loop, which you `break` when the
user quits, e.g.:

    
    
    while True:
        user_input = int(input("Which die would you like to roll (0 to quit)? "))
        if user_input in (4, 6, 12):
            dice_roll(user_input)
        elif user_input:
            print("Not an acceptable die.")
        else:
            break
    

Note that your `dice_roll` function currently always rolls a 12-sided die, and
could be simplified:

    
    
    def dice_roll(sides):
        number = random.randint(1, sides)
        print(number)
        return number
    

(this also removes the limit to 4, 6 and 12 only, so you may want to revise
the input loop accordingly).

