Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What is the command to add an attribute 'color' to a class 'Car'?
Think about how you would assign a property to an object.
How can we dynamically add a method to a class?
Similar to how you would add an attribute.
Which command is used to add an attribute dynamically to an existing class?
Recall the built-in functions for attribute manipulation.
True or False: You can add methods to a class after it has been defined.
Think about how flexible Python classes are.
Create a class 'Vehicle'. Add attributes 'make' and 'model' dynamically, then define a method 'info' that returns a sentence with make and model.
Use lambda functions for quick method creation if needed!
Discuss how you would dynamically inject different behavior in classes used for a game character that may change abilities.
Think about gameplay events and character states influencing behavior.
5 more questions in this section. Enroll free to practise them all.
Enroll free