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 trial

Python Using Databases in Python Gettin' CRUD-y With It CRUD: Create Function

create_challenge

Error msg says Didn't find the challenge he asks me to create, I tried several combinations to fulfill the argument, but not sure what to put for name, language. Steps I assume to put = 1, as told, but what about the other two? Do they need to be created? Not sure if I understand error msg in relation to the problem task.

crud.py
from models import Challenge

def create_challenge(name, language, steps):
    Challenge.create(name = 'Challenge', language = 'English', steps = 1)

2 Answers

Stephen Cole
PLUS
Stephen Cole
Courses Plus Student 15,809 Points

Without all the steps handy, I have to go from memory...

The default "steps=1" is part of the function, not part of the call.

Also, you're going to pass "name", "language", and "steps" via the function. So, you don't need to make them explicit.

Adeyemi Babalola
Adeyemi Babalola
2,661 Points

I had similar issues but i realize that i did not call the function.

crud.py
from models import Challenge

def create_challenge(name, language, steps=1):
    Challenge.create(name=name, language=language, steps=steps)

create_challenge("Challenge", "English")