From the course: Advanced Python: Build Hands-On Projects with Design Patterns (2023)
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Solution: Building an account object - Python Tutorial
From the course: Advanced Python: Build Hands-On Projects with Design Patterns (2023)
Solution: Building an account object
- [Instructor] So how did it go? Were you able to figure out the code challenge? You may have noticed that I left out some director code. The missing parts are necessary for the director to build a student account. Therefore, type self._builder.add_type, self._builder.add_id, self._builder.add_clearance. When it comes to creating our student account object, we still need to make our director build the account by invoking the construct_ account method. Type director construct_account. Next, retrieve the student account object by calling the get_account method and put it in a variable called account. Type account, director.get_account. Finally, instead of returning None, return the account object. That's it. Let's test the code by clicking on Test My Code. The code works beautifully. If you didn't get this first try, give it another go. What's important is you understanding how the code flows and works.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.