Saved Bookmarks
| 1. |
Answer the questions (i) and (ii) after going through the following class definition: class Toy :tid =0;tcat = “ “def __init__(self):// Function1..................................... // Blank 2(i) Explain relevance of Function 1.(ii) (a) Fill in the blank 2 with a statement to create object of the class TOY.(b) Write statement to check whether tprice is an attribute of class TOY. |
|
Answer» (i) __init__ function is used to initialize the members of a class. It is automatically invoked when the object of the class is created. (ii) (a) T=Toy() (b) hasattr(T,tprice) |
|