Quick actions

cmd+k|ctrl+k

Navigation

Languages

Attributes and Methods

Snippet info

Language

Python

Visibility

public

Author

fpuleano

Created

2023-04-18T13:23:43.469353Z

Updated

2023-04-18T13:55:00.987109Z

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)
INFO