-
-
Save eclecticmiraclecat/6835fa4e40b8c0b601a4383c1a07e288 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> ''' | |
... build quiz game with users | |
... | |
... Users | |
... | |
... Name: alice | |
... Score: 3 | |
... | |
... Name: bob | |
... Score: 6 | |
... | |
... Functionality | |
... + Ability to increase score | |
... ''' | |
>>> | |
>>> class User: | |
... def __init__(self, name, score): | |
... self.name = name | |
... self.score = score | |
... def increment(self): | |
... self.score += 1 | |
... | |
>>> user1 = User('alice', 3) | |
>>> user1.score | |
3 | |
>>> user1.increment() | |
>>> user1.score | |
4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment