forked from kal179/Beginners_Python_Examples
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclass_animal.py
More file actions
22 lines (20 loc) · 729 Bytes
/
class_animal.py
File metadata and controls
22 lines (20 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class Animal:
def __init__(self, species, name, legs, color, voices):
self.species = species
self.name = name
self.legs = legs
self.color = color
self.voices = voices
cat = Animal("Cat" , "Pussy-Cat" , 4 , "white" , "meow")
dog = Animal("Dog" , "Cloudy", 4 , "brownie" , "bark")
print("Species of animal : ",dog.species)
print("name of animal : ",dog.name)
print("no. of legs : ",dog.legs)
print("color of animal : ",dog.color)
print("voice of animal : ",dog.voices)
print(" ")
print("Species of animal : ",cat.species)
print("name of animal : ",cat.name)
print("no. of legs : ",cat.legs)
print("color of animal : ",cat.color)
print("voice of animal : ",cat.voices)