I was trying to make a simple dice in py, and I tried to make so you can change the amount of sides the dice has and if it's left empty, to default to 6. But when I input something, it crashes.
import keyboard #Import keyboard stuff like enter (pip install keyboard)
import random #Import random stuff
import time
sides = 1
sidesSelect = input("Amount of sides the dice has. If empty, 6: ")
is_non_empty= bool(sidesSelect)
if is_non_empty is False:
sides = 6
else:
sides = sidesSelect
time.sleep(0.5)
while True:
nmb = random.randint(1,sides) #Get random integer
print("The dice rolled ", nmb)
input('Press enter to roll the dice again') #Ask if you want to throw again
time.sleep(random.uniform(0.2,0.8))
I already tried changing == is, and nothing happened
if is_non_empty is false: