Created
June 9, 2022 15:23
-
-
Save StephenFordham/2e6bb5c197b50a8ec445d62c20aa40da to your computer and use it in GitHub Desktop.
Instantiating an instance of the Employees class
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
class Employees(object): | |
def __init__(self, name, age, location): | |
self._name = name | |
self._age = age | |
self._location = location | |
e1 = Employees('stephen', 30, 'Bournemouth') | |
for key, value in e1.__dict__.items(): | |
print('{}: {}'.format(key, value)) | |
# Console output: | |
_name: stephen | |
_age: 30 | |
_location: Bournemouth |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment