Advertisement
otorp2

python init oop

Jan 13th, 2020
455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. class Computer:
  2.     """"""
  3.  
  4.     def __init__(self,xpos):
  5.         """Constructor"""
  6.         self.xpos = xpos
  7.        
  8.        
  9.     def loc(self):
  10.         print(self.xpos)
  11.        
  12. com1 = Computer(33)  #object
  13.    
  14. com1.loc()
  15. com1.loc()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement