We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
You use self.variable so it can be used inside other methods of your class, otherwise is not going to be accessible to them. It also makes your attribute/variable avaible to be called by '.' notation. ex. instance.age
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 4: Class vs. Instance
You are viewing a single comment's thread. Return to all comments →
You use self.variable so it can be used inside other methods of your class, otherwise is not going to be accessible to them. It also makes your attribute/variable avaible to be called by '.' notation. ex. instance.age