Attributes and Methods

Run Settings
LanguagePython
Language Version
Run Command
class PlayerChar: membership = True # Class Object attribute, they are not dynamic but static...it does not change across instances. def __init__(self, name, age): if (PlayerChar.membership): self.name = name #attributes self.age = age def shout(self): print(f'my name is {self.name}') player1 = PlayerChar('Cindy', 44) player1.attack = 75 player2 = PlayerChar('Thomas', 27) player3 = PlayerChar('Bobbi', 32) print(player1.shout()) print(player1.age) print(player2.name) print(player2.age) print(player3.shout()) print(player3.age) print(player1.attack) print(player1.membership) print(player2.membership) print(player3.membership) help(player1) help(list)
Editor Settings
Theme
Key bindings
Full width
Lines