Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

crud.py
from models import Challenge
def create_challenge(name,language,steps=1):
  Challenge.create(name='name',language='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.

Vittorio

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