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 a function named create_challenge() that takes name, language, and steps arguments. Steps should be optional, so

I'm getting error 'Didn't get what I asked you to create'.What part am i missing???please help

from models import Challenge
def create_challenge(name,language,steps=1):

2 Answers

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hello Natasha.

Your code is pretty close, there are only a couple of mistakes that I can see.

1) when a you want an argument to be optional you put it equal to 0 and not to 1.

2) inside the function, when you actually create the Challenge, you don't need to set the values equal to the strings that you wrong, you want them to be equal to the arguments we pass in into the function.

Please let me know if not clear.


Thank you Vittorio for pointing out my mistakes,managed to get it to work !