Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ch10-primer-on-oop/2-instantiate-an-object.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ class Dog:
species = "Canis familiaris"

def __init__(self, name, age, coat_color):
if not name:
raise ValueError("Missing Name") #Use if use User Input!!
elif not age:
raise ValueError("Missing Age")
elif not coat_color:
raise ValueError("Missing Coat_color")
self.name = name
self.age = age
self.coat_color = coat_color
Expand Down