num = input('Select faces of Dice between [4, 6, 8, 12, 20].\n')
my_dice=Dice(int(num))
com_dice=Dice(int(num))
In class Dice
, the __init__
method compares num
with [4,6,8,12,20]
, and if there isn't a match, it prints an error message. I tried but it always print error message even if I enter 4
or 6
. I thought input
get its argument with type str
, so I changed Dice(num)
into Dice(int(num))
then it worked.
I want to know how I can get its argument type int
when I enter it.
I'm using repl.it, with Python 3.