Advertisement
mikjaer

Untitled

Feb 9th, 2023
902
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | Fixit | 0 0
  1. #!/usr/bin/python
  2.  
  3. import pprint
  4.  
  5. class Person:
  6.         def __init__(self, name):
  7.                 self.name = name
  8.                 self.f = []
  9.  
  10.         def Name(self):
  11.                 return self.name
  12.  
  13.         def F(self,f):
  14.                 self.f.append(f)
  15.  
  16. p1 = Person("Mike")
  17. p1.F("kode")
  18. p1.F("mad")
  19.  
  20. p2 = Person("Diana")
  21. p2.F("film")
  22. p2.F("bittune")
  23.  
  24. print(p1.Name())
  25. pprint.pprint(p1.f)
  26.  
  27. print(p2.Name())
  28. pprint.pprint(p2.f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement