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!

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

Am I missing something?

I've created a function 'sys.stdin.read()' that is supposed to capture the name, language and steps arguments. I've tried using lists in 'sys.stdil.read([name, language, steps])' but to no avail

from models import Challenge
import sys

def create_challenge(name, language, steps):
    data = sys.stdin.read([name, language, steps])
    Challenge['name'] = data[name]
    Challenge['language'] = data[language]
    Challenge['steps'] = data[steps]

2 Answers

This is more of a question than an answer, but could this be part of why things didn't run?

from models import Challenge # could the fact that challenge is capitalized be an issue?
import sys

I am humbly asking / suggesting

Megan Amendola
.a{fill-rule:evenodd;}techdegree seal-36
Megan Amendola
Treehouse Teacher

Hi! You don't need sys the arguments are already being passed in and are accessible inside of your function. The second part is to create a challenge and pass in the values. The steps argument should also have a default of 1.

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