how to create a loop that will make sure that my dice can be rolled as many times as required?
here's my code as a start off.

import random
dice=random.randrange(1,5)
dice2=random.randrange(1,7)
dice3=random.randrange(1,13)

sim=input (“Which sided dice would you like to roll? You can choose a 4-sided dice, a 6-sided dice or a 12-sided dice.”)
if output=4
then print (“The 4-sided dice has rolled to”,dice)
elif output=6
then print (“The 6-sided dice has rolled to”,dice2)
elif output=12
then print (“The 12-sided dice has rolled to”,dice3)
else input (“Please input a number 4, 6 or 12”)

there are errors within my coding, but i am more concerned about creating the loop, thanks (:
please don't be harsh, im new to python

You can apply an endless while loop (with an exit condition) like this ...

import random

# optional, make string input work with Python2 or Python3
try: input = raw_input
except: pass

info = '''
Which sided dice would you like to roll? You can choose a
4-sided dice, a 6-sided dice or a 12-sided dice.
(Type 0 to exit the loop)
'''
print(info)

while True:
    dice = random.randrange(1,5)
    dice2 = random.randrange(1,7)
    dice3 = random.randrange(1,13)
    sides = int(input("Input number 4, 6 or 12 > "))
    if sides == 0:
        break  # exit the endless while loop
    elif sides == 4 :
        print("The 4-sided dice has rolled to", dice)
    elif sides == 6 :
        print("The 6-sided dice has rolled to", dice2)
    elif sides == 12:
        print("The 12-sided dice has rolled to", dice3)
    else:
        print("Please input a number 4, 6 or 12")

Study the example code closely so you learn.

thank you, but raw_input doesn't work for me... is there something else i can use?

The way it is coded it should work with Python2 or Python3.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.