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 Python Basics Functions and Looping Create a Function

I'm stuck on this! Can someone help?

def repeat_twice(square)
return square * 2

2 Answers

Antonio De Rose
Antonio De Rose
20,885 Points

so many errors within python and there are few errors, where it would work in within python env, but not treehouse

1) when you declare a function, maker sure you mention the colon to end with: (python error) 2) after the function, where is the indentation, in the next line (python error) 3) treehouse question asks you declare a function in a specific name (not a python error) 4) the parameter too have been asked to be mentioned in a certain name (not a python error)

You're doing great! To sum up what Antonio said,

  1. Make sure after you call your function (after square) you put a colon.
  2. Indent the body of your function, or line two of this code.
  3. Make sure your names of functions, variables, etc. match the names the challenge wants you to use. After doing these three steps, you should be on your way!