课程: Advanced Python: Build Hands-On Projects with Design Patterns (2023)

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Solution: Building an account object

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.

内容