{"id":24021140,"url":"https://github.com/zipcodecore/python10ex","last_synced_at":"2026-02-07T09:31:02.474Z","repository":{"id":147838203,"uuid":"470306586","full_name":"ZipCodeCore/Python10Ex","owner":"ZipCodeCore","description":null,"archived":false,"fork":false,"pushed_at":"2022-03-15T19:38:08.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-01T21:31:44.126Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZipCodeCore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-15T19:38:06.000Z","updated_at":"2022-03-15T19:38:06.000Z","dependencies_parsed_at":"2023-04-06T06:47:47.101Z","dependency_job_id":null,"html_url":"https://github.com/ZipCodeCore/Python10Ex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ZipCodeCore/Python10Ex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FPython10Ex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FPython10Ex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FPython10Ex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FPython10Ex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZipCodeCore","download_url":"https://codeload.github.com/ZipCodeCore/Python10Ex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FPython10Ex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29191385,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T07:37:03.739Z","status":"ssl_error","status_checked_at":"2026-02-07T07:37:03.029Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-08T12:39:25.522Z","updated_at":"2026-02-07T09:31:02.451Z","avatar_url":"https://github.com/ZipCodeCore.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Part 10\n\n## Accompanying resources\n* Slide deck: https://zipcoder.github.io/reveal-slides.data-engineering/zcw_content/python/fundamentals-part10.html\n\n## Exercise 1\n\nCreate a program called *small_town_teller.py*\n\nDeclare a **Person** class with the following attributes:\n* id\n* first name\n* last name\n\nDeclare an **Account** class with the following attributes:\n* number\n* type\n* owner\n* balance\n\nDeclare a **Bank** class able to support the following operations:\n* Adding a customer to the bank\n* Adding an account to the bank\n* Removing an account from the bank\n* Depositing money into an account\n* Withdrawing money from an account\n* Balance inquiry for a particular account\n\nFrom an interactive terminal, you should be able to import these classes an interact with the objects and methods defined above.\n\n**Constraints**\n\n* When attempting to register a customer, the customer id must be unique.\n* When attempting to add an account, the user associated with said account must already registered as a customer.\n* When attempting to add an account, the account number must be unique.\n\n\n```python\nfrom small_town_teller import Person, Account, Bank\n\nzc_bank = Bank()\nbob = Person(1, \"Bob\", \"Smith\")\nzc_bank.add_customer(bob)\nbob_savings = Account(1001, \"SAVINGS\", bob)\nzc_bank.add_account(bob_savings)\nzc_bank.balance_inquiry(1001)\n# 0\nzc_bank.deposit(1001, 256.02)\nzc_bank.balance_inquiry(1001)\n# 256.02\nzc_bank.withdrawal(1001, 128)\nzc_bank.balance_inquiry(1001)\n# 128.02\n```\n\n## Exercise 2 \n\nCreate a program called *persistent_small_town_teller.py*\n\nDeclare a **PersistenceUtils** class with the following static methods:\n* write_pickle\n* load_pickle\n\nAppend the following methods to the **Bank** class:\n* save_data\n* load_data\n\nThis application should extend exercise one so that all of the customers and accounts persist between restarts.\n\nFrom an interactive terminal:\n* Create customers and accounts. \n* Save the data using the save_data method.\n* Exit the session.\n* Create a new session.\n* Validate there are no customers and no accounts.\n* Load the saved data using the load_data method.\n* Validate the persistence is working.\n\n```python\nfrom persistent_small_town_teller import Person, Account, Bank\n\nzc_bank = Bank()\nzc_bank.customers\n# {}\nzc_bank.accounts\n# {}\nzc_bank.load_data()\nzc_bank.customers\n# {1: \u003cpersistent_small_town_teller.Person object at 0x1098e6a90\u003e}\nzc_bank.accounts\n# {1001: \u003cpersistent_small_town_teller.Account object at 0x1099e04d0\u003e}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipcodecore%2Fpython10ex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzipcodecore%2Fpython10ex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipcodecore%2Fpython10ex/lists"}