recently getting in to python and im finding classes a bit challenging.
Program below im just trying to simulate a simple dice roll to practise classes. Specifically not sure why i'm getting the error here where i can't seem to reference self.sides
Thanks!
import random
class Dice(object):
def __init__(self,sides):
self.sides = sides
def getSides(self):
return self.sides
def __str__(self):
return
def RollDice(self):
# create list with each potential number
outcomes=[]
temp = self.sides() **<----------- 'int' object is not callable**
for i in range(0,temp+1):
outcomes.append(i)
# select random number
roll = random.choice(outcomes)
print(roll)
normal=Dice(6)
normal.RollDice()
= self.sidesor= getSides().