Function Junction help! 2/19

Please help me! This is my code and I don’t know what’s wrong!

def spam():
“”“Prints ‘Eggs’ to the console.”""
print"Eggs!"

And the error message is:
Oops, try again. Make sure to indent the body of your function appropriately!

Please help me if you know how!

You add four indentations for each ‘level’ of your code, usually after a colon. Example:

def hi():
    print "Hello there!"

Also, the exclamation mark in your print may cause you trouble, as the output must be exact.

3 Likes

Thank you so much for the help @cadecodes!

def spam():

great work

print “”“Eggs!”""

Define the spam function above this line.

spam()

i got the following error
Oops, try again.
Make sure to indent the body of your function appropriately!

def spam():

great work

"""print 'Eggs!' to the console"""
print "Eggs!"

Define the spam function above this line.

spam()

I finally got it myself.

This is the solution I found with my comments in it:

def spam():
“”“print ‘Eggs!’ to the console”“”
print “Eggs!” #needs to be indented

spam () #need to add this line of copy to trigger the function

but it still dsnt work wht to do??

:confused::sob:

It looks like the comments should be indented as well

Anybody solved this? i’m stuck here pls help

Define your spam function starting on line 5. You

can leave the code on line 11 alone for now–we’ll

explain it soon!

def spam():

“”“print “Eggs!” to the console”""

print “Eggs!”

Define the spam function above this line.

spam()

it keeps saying the body needs to be indented

Finally got it myself. Thanks.

share with us your solution. Some people stuck in this section

indent your comment and print "Eggs! " properly. Meaning you push your space bar four times before you type your comment and print. if you do it well, it will start where spam start as well.

def spam():
“”“Prints ‘Hello World!’ to the console.”“”

print “Eggs!”

This works, try it

This worked for me!

You need to add 4 spaces before the triple "'s
Example:

def spam():
“”“This prints eggs to wherever”""
print “Eggs”
spam()

1 Like

How to repair?

Write the code above line 10, just as the comment on line 10 says.

Your current answer should work that perfectly if you do that, hopefully this helps.

You can’t delete the spam() at the end. This closes the function.

Triple quotation:smile_cat: