Function Junction easy question


#1

Instricion:
Go ahead and create a function, spam, that prints the string "Eggs!" to the console. Don't forget to include a comment of your own choosing (enclose it in triple quotes!).

Code:

def spam():
    """doctrine quote"""
    return "Eggs!"
    print "Eggs!"

Error:
Oops, try again. Make sure your function prints "Eggs!" to the console!

I've been trying with return, with print, and both. Nothing works.


#2

Hi!

You are told to only print "Eggs!". So you have it as:

def spam():
    """doctrine quote"""
    print 'Eggs!'

Then, you also need to call that function, to have:

def spam():
    """doctrine quote"""
    print 'Eggs!'
spam()

Hope this helps! :wink:


#3

Thank You, closed question.


#4

yup ...it worked ...u need to close the define function


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.