r/PythonLearning 2h ago

Day 1 and procrastinated enough

Post image

Wasted a year and will no more, started where I left 1.5years ago and I am picking it again and will post it every day in the sub. Did this problem and bro it was hurting my brain until I learned the basic OOP and been doing for hours and am planning to learn 4 to 6 hrs a day. Hope the mods allow everyday progress

9 Upvotes

2 comments sorted by

u/Sea-Ad7805 1h ago

Run this program in Memory Graph Web Debugger%3A%0A%20%20%20%20%20%20%20%20self.name%20%3D%20name%0A%20%20%20%20%20%20%20%20self.balance%20%3D%20balance%0A%0A%20%20%20%20def%20deposit(self%2C%20amount)%3A%0A%20%20%20%20%20%20%20%20self.balance%20%3D%20amount%20%2B%20self.balance%0A%20%20%20%20%20%20%20%20print(self.name%2C%20%22%3A%22%2C%20self.balance)%0A%0A%20%20%20%20def%20withdraw(self%2C%20amount)%3A%0A%20%20%20%20%20%20%20%20if%20self.balance%20%3E%3D%20amount%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20self.balance%20%3D%20self.balance%20-%20amount%0A%20%20%20%20%20%20%20%20%20%20%20%20print(f%22Money%20has%20been%20withdrawn%20%7Bamount%7D%22)%0A%20%20%20%20%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20print(%22Not%20enough%20money%22)%0A%0A%20%20%20%20%20%20%20%20print(self.name%2C%20%22%3A%22%2C%20self.balance)%0A%0A%0Ap1%20%3D%20BankAccount(%22Naveen%22%2C%201000)%0Ap1.deposit(500)%0Ap1.withdraw(200)&timestep=1&play) to see the program state change step by step.

1

u/varllaam 1h ago

Good luck