Introduction to Functions

← Forum
606 pts

Nikita Yerenkov-Scott

I am not too sure what to do?

Can any body help me as I don't know what to do?

  • 739 pts

    Devon Campbell

    -1 votes

    You're defining a function called "spam" that will then be called later on in the program. Use the definition syntax described previously.

    To get you started, here's what you need:

    def spam():
    

    After that, you'll tab over on the next line and start your docstring. This is just a string directly below the line that defines your function name. It's going to be enclosed in triple quotes (and the grader only seems to accept double quotes (") where Python would allow you to choose double quotes or single quotes (').

    So, after you put that line above to define the name, go down to the next line. Tab over if the editor doesn't do that automatically for you. Type three quotes to start your doc string. Type a short description of what your function does. Then, go to the next line. You still want to be tabbed over once because you are now ready to type out the code block that will make up the functionality of your function. Then, just input a statement or series statements that will print the string "Eggs!" to the console.

    I hope this helps. If not, ask some specific questions so we will know where you are having problems.

Sign in to post to the forum.

Sign in