Function Junction help! 2/19


#1

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!


#2

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

Thank you so much for the help @cadecodes!


#4

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!


#5

def spam():

great work

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

Define the spam function above this line.

spam()

I finally got it myself.


#6

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


#7

but it still dsnt work wht to do??

:confused::sob:


#8

It looks like the comments should be indented as well


#9

Anybody solved this? i'm stuck here pls help


#10

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


#11

Finally got it myself. Thanks.


#12

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


#13

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.


#14

def spam():
"""Prints 'Hello World!' to the console."""

print "Eggs!"

This works, try it


#15

This worked for me!


#16

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

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


#18

How to repair?


#19

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.


#20

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


#21

Triple quotation:smile_cat: