this first code im going to show you works
def spam():
"""Prints the word eggs!"""
egg = "Eggs!"
print (egg)
spam()
But this one does not work i don't under stand
def spam():
"""Prints the word eggs!"""
print "Eggs!"
spam()
Turns out i was missing the brackets in the print "Eggs!" should have been print ("Eggs!")
1 Answer 1
You must be using python 3, since it requires parentheses with a print statement. Try to do:
print("Eggs!")
Instead of:
print "Eggs!"
Notice how your first function has parenthesis:
print(egg)
That's why it works.
Sign up to request clarification or add additional context in comments.
Comments
lang-py
printparametersEggs!noteggs!