American Young Coder

AYC logo
Loading Events

« All Events

  • This event has passed.

7 PM – Python OOP – Joel

April 1 @ 7:00 pm - 8:00 pm

Today we did:
  1. We reviewed the homework and starting learning about OOP and classes.
Homework:

 

  1. Come up with a class you want to make. It should be a specific type like Mario for example, because making multiple Marios wouldn’t make sense. Instead, the right way to do it is making a GameCharacter class for example, and you can make multiple game characters in that case. But that class name is up to you.
  2. Make a new file called April1_<your_class_name>.py.
  3. Inside this, make the class of your choice, and create the constructor (or init method) like we did in the previous file. Fill it in with 3 attributes of your choice (remember to keep them as relevant and realistic as possible).
  4. Then, in the same file outside the class, create multiple objects of that class (for example if the class is Vegetable, you’re actually creating the vegetables and filling the attributes in, just like we did today).
  5. Then, for each object of the class, access all of their attributes one by one and print them. Remember the power of the “.” operator, which can access attributes and methods.

If you have any questions, feel free to me at joel@ayclogic.com.

Details

Date:
April 1
Time:
7:00 pm - 8:00 pm