Skip to content

TT2 Python Classes

Allie Xiao edited this page Apr 5, 2022 · 1 revision
  • Organization: time box for each week, file directories, menu
  • Code needs to run on replit and IntelliJ
  • Object-oriented programming focuses on organizing and modifying data (flexible, abstracts complexity)
  • Objects are variables (attributes) and functions (methods)
  • init happens when class is called, object is made
  • call is Python-exclusive, gives object ability to act as function
  • First need to make object/instance, then use it as function and pass parameter. This will call method and return output
  • See Users class example on nighthawkcoders wiki for example of complex class
  • init gives ability to perform CRUD
  • class Users(db.Model): uses inheritance, object acts as library

Clone this wiki locally