Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

int(D6)

Should int(d6 object) always be equal to 6? I assume

class D6(Die): def init(self, value = 0): super().init(sides = 6, value = value)

should overwrite the Die class and thus made sides always 6. But It still gets set to a random number in my case

1 Answer

Steven Parker
Steven Parker
229,657 Points

A "D6" always has 6 sides. But the whole purpose of it is to model a dice cube, so the value of it will be a random number from 1 to 6.

Honestly, I can't believe I didn't realise this. It all makes sense now :D