Advertisement
Luninariel

Python Week 7 Example

Oct 9th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. class MyClass:
  2.     def __init__(self, favoriteWord):
  3.         self.myProperty = favoriteWord
  4.        
  5.     #The ToString for Python so that objects can be printed
  6.     def __str__(self):
  7.         return self.myProperty
  8.  
  9.    
  10. class Dog:
  11.     def __init__(self, name, weight, color,):
  12.         self.name = name
  13.         self.weight = weight
  14.         self.color = color
  15.  
  16.     def make_noise(self):
  17.         print('woof')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement