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 trialMyles Brathwaite
1,971 Points__init__ Parameters
For the A paraemters that are assigned to init are they just incase the user doesn't input any arguments when they call the class?
import random
class Die:
def __init__(self, sides=2, value=0)
1 Answer
Steven Parker
231,261 PointsThat's right, the default values will be used if the arguments are omitted in the call.
nicholas hartford
24,276 Pointsnicholas hartford
24,276 PointsWhen you assign a value to an argument in a method it becomes a default value. So the method call can omit them and still have an argument. I hope that helps.