Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialellie adam
26,377 Pointsmake a class Sheep Q 1 of 3
import Animal from animal.py
class Sheep(Animal):
Animal_class = "sheep"
pass
import Animal from animal.py
class Sheep(Animal):
Animal_class = "sheep"
pass
I am getting error. import Animal from animal.py is not right.
2 Answers
Dan Johnson
40,533 PointsYou don't need to specify the file extension when importing a module. Also importing a specific part of a module follows the form:
# from <module> import <class> as <alias>
from animal import Animal
You have the inheritance correct so you should be fine after that, but if not you could try removing the property Animal_class as it's not required.
ellie adam
26,377 Pointsfrom animal import Animal
class Sheep(Animal):
pass
I was passing wrong syntax :) Thanks Dan!