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”)

what is wrong with my coding? I think it is something to do with the 'output'...

Edited 2 Years Ago by Dani: Formatting fixed

You have quite a few mistakes. This will work, look at it closely ...

import random

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

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

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.
'''
print(info)

sides = int(input("Input number 4, 6 or 12 > "))
if 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")

For the sake of others, avoid tabs for indentations, use spaces.

This question has already been answered. Start a new discussion instead.