Created
September 24, 2020 19:45
-
-
Save mayankdawar/a2949fa68e4f5e75f36de6f0e2962653 to your computer and use it in GitHub Desktop.
Define a class called BankAccount that accepts the name you want associated with your bank account in a string, and an integer that represents the amount of money in the account. The constructor should initialize two instance variables from those inputs: name and amt. Add a string method so that when you print an instance of BankAccount, you see…
This file contains 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 BankAccount: | |
def __init__(self, name, amt): | |
self.name = name | |
self.amt = amt | |
def __str__(self): | |
return 'Your account, {}, has {} dollars.'.format(self.name, self.amt) | |
t1 = BankAccount('Bob',100) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment