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 (2015) Logic in Python Fully Functional

Christian Rachal
Christian Rachal
4,039 Points

Having trouble with hows_the_parrot and workspace

Here's my code:

def hows_the_parrot(): print("He's pining for the Fjord!")

hows_the_parrot()

def lumberjack(): if name.lower() == 'kenneth': print("Kenneth's a lumberjack and he's OK!") else: print("{} sleeps all night and {} works all day!".format(name, name))

lumberjack("Kenneth")

When I enter it, it gives me this message:

treehouse:~/workspace$ python functions.py
He's pining for the Fjord!
Traceback (most recent call last):
File "functions.py", line 12, in <module>
lumberjack("Kenneth")
TypeError: lumberjack() takes 0 positional arguments but 1 was given

8 Answers

Josh Bennett
Josh Bennett
15,258 Points

You have

lumberjack("Kenneth")

Make the K lowercase and you're golden.

the .lower() method is checking for a lower case argument. Just for fun, take out the .lower() and see if it works as is.

Josh Bennett
Josh Bennett
15,258 Points

AAAhhhh. Ok. look at line 1 the

def lumberjack():

Should be ...

def lumberjack(name):

you need to pass an arguement in the function.

Josh Bennett
Josh Bennett
15,258 Points

Also, click markdown cheat sheet below and format your questions/responses using the formatting best practices. Makes everything easier to read and easier to diagnose.

Josh Bennett
Josh Bennett
15,258 Points

Keep this handy. And take the console foundations and markdown courses.

Markdown Cheatsheet Markdown is a short-hand syntax for easily converting text to HTML. Below are some popular examples of Markdown formatting. For more examples reference Markdown Basics for a more detailed overview.

Links This is an example link

Code Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

      ```html
      <p>This is code!</p>
      ```

Quoting If you're replying to someone, you can copy portions of their text into your reply, and mark them as quotations by putting > at the start of each line.

      > This line is quoted.

Italic Here’s a word that is emphasized

Bold Here’s a word that is bold

Images alt text

Unordered List

  • Candy
  • Gum
  • Peanuts

Ordered List

  1. Red
  2. Green
  3. Blue
Christian Rachal
Christian Rachal
4,039 Points

Thanks for your help Josh. I changed "Kenneth" to "kenneth" and I am still getting the same error message.

"treehouse:~/workspace$ python functions.py
He's pining for the Fjord!
Traceback (most recent call last):
File "functions.py", line 12, in <module>
lumberjack("kenneth")
TypeError: lumberjack() takes 0 positional arguments but 1 was given "

Christian Rachal
Christian Rachal
4,039 Points

Still not fixed, I will repost in the correct format ASAP.

When I click the Markdown Cheatsheet link, it takes me here: https://teamtreehouse.com/community

Surely, that's not right? I don't see a cheat sheet in the forum anywhere even when using the search bar.

Christian Rachal
Christian Rachal
4,039 Points

I started a new workspace and made sure to save my file every time I made a change. My code works now. Not sure what the issue was before. Thanks Josh!

Josh Bennett
Josh Bennett
15,258 Points

Ok that wasn't super helpful because the markdown in the markdown file just formated. ugh. Just take the markdown course.