You should really state which programming language you're using. I'm assuming this is Python, but if it's not my answer might be wrong.
Your problem is that you need to be using elif
, not if. You're also trying to implicitly convert between strings and integers, which doesn't work. This code should, unless I've missed something else.
import random
loop=1
while loop == 1:
dice=input("Choose dice 4,6 or 12 sided")
if dice =="4":
n=random.randint(1,4)
print(dice)
print(str(n))
elif dice =="6":
n=random.randint(1,int(dice))
print(dice)
print(str(n))
elif dice =="12":
n=random.randint(1,int(dice))
print(dice)
print(str(n))
else:
print("Error")