Here's an edit that keeps your original structure. As a beginner, don't hesitate to write simple, straightforward code as you did. Your primary effort should be getting the program to work. You can always go back and refactor/rewrite code using the latest concepts you've learned. That's how it's done at all skill levels.
In this case, using while True: eliminates the compound OR statement. You could use either OR's or AND's with == and != respectively. Also, when using a while loop, you should initialize the checked value - number - outside the loop with a passing value, i.e. one that allows entry to the loop.
number = 0
while number != 4:
#do stuff
number = someNewValue
A couple of things you need to understand when using compound AND/OR conditions are short circuiting and operator precedence.
import random
while True: # loops until break
number = int(input("Would you like to use a 4, 6 or 12 sided die?\n"))
if number == 4:
import random
random4 = random.randint(1, 4)
print("Your 4 sided die rolled a" ,random4)
break
elif number == 6:
import random
random6 = random.randint(1, 6)
print("Your 6 sided die rolled a" ,random6)
break
elif number == 12:
import random
random12 = random.randint(1, 12)
print("Your 12 sided die rolled a" ,random12)
break
Once it's working, several ideas from the other posts should be applied. Other ideas are to make this a function and make the list of die sizes a variable.
Final code might look something like this.
from random import randrange
DIE_CHOICES = {4, 6, 12}
def roll(choices):
while True:
try:
choice = int(input('Would you like to use a 4, 6 or 12 sided die?\n'))
except ValueError:
continue
if roll in choices:
return choice, 1 + randrange(choice)
else:
print 'Please pick a legal die size.\n'
print 'Your {} sided die rolled a {}.'.format(roll(DIE_CHOICES))
This makes things a little more generic and eliminates duplicate/redundant code.