Function Junction


Can someone explain why I'm stuck here?????????

def spam():
    print "Eggs!"


Hi bmastrandrea,

I copy/pasted and submitted your code in exercise 2/19 and it worked perfectly.

What error message are you seeing?



As happened with @albionsrefuge, your function worked correctly when I copied and submitted it. But, your post omitted the following line, and in fact, if you removed it from the code that you submitted, it will not pass:


That statement calls the function, so that it produces the output.


oh, ok thank you all


i still don't get it…


Remember to put the code above the line where it says write your code above


the 'spam()' at the end calls the (def)ined function called spam and does that code so it will run the 'spam' and print out 'Eggs!"

def spam():
    print "Eggs!"

  1. # Define your spam function starting on line 5. You
  2. # can leave the code on line 11 alone for now--we'll
  3. # explain it soon!
  4. def spam():
  5. """Prints 'Eggs!' to the console"""
  6. print 'Eggs!'
  7. # Define the spam function above this line.
  8. spam()

It's telling you to define the Function on line 5, so after line 8 just type" spam() ".


don't delete and paste put it on line 6 and paste