Quick actions

cmd+k|ctrl+k

Navigation

Languages

Toy

Snippet info

Language

Python

Visibility

public

Author

chausage

Created

2024-12-05T06:31:07.104404Z

Updated

2024-12-05T07:43:41.115615Z

class toy: #
    head='blue'
    body='red'
    def a(self,x): #a, you can be any word. 'you' becomes toy1 / 2 
        print('toy is running', self.body)
toy1=toy()
toy2=toy()
print(toy1.head, toy1.body)
print(toy1) #show the address of toy1
print(toy2) #show the address of toy2
toy1.a(1) #assign x=1
toy2.a(2) #assign x=2
print(toy1.a) #show the address of toy1.a()
print(toy2.a) #show the address of toy2.a()
INFO