Snippets Collections
class Band:
 
  bandcount = 0
 
  def __init__(self, name, instrument): #these are attributes
          self.name = name
          self.instrument = instrument
          Band.bandcount += 1
 
  def displayInstrumnet(self): #this is a method
          print(self.name, "plays", self.instrument)
 
  def bandCount(self):
          print("# of Bandmembers = ", Band.bandcount)
star

Sun Aug 22 2021 20:15:15 GMT+0000 (Coordinated Universal Time)

#python #ooo

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension