So i am making a quick dice roller (for D&D) and when I try to roll dice it only generates numbers from 1 to 4!
import random
def d4():
x = (random.randint(1,4))
print(x)
def d6():
x = (random.randint(1,6))
print(x)
def d8():
x = (random.randint(1,8))
print(x)
def d10():
x = (random.randint(1,10))
print(x)
def d12():
x = (random.randint(1,12))
print(x)
def d20():
x = (random.randint(1,20))
print(x)
def d100():
x = (random.randint(1,100))
print(x)
choice = input("What dice will you roll: ")
if choice == "d4" or "4":
d4()
elif choice == "d6" or "6":
d6()
elif choice == "d8" or "8":
d8()
elif choice == "d10" or "10":
d10()
elif choice == "d12" or "12":
d12()
elif choice == "d20" or "20":
d20()
elif choice == "d100" or "100":
d100()
else:
print(random.randint(1,20))
For example when I put my input as d100 I can only get 1,2,3, or 4! what on earth is going on?!