Whitespace Means Right Space
def spam():
eggs = 12
return eggs
print spam()
Notice the error you got when you ran the code in the editor:
IndentationError: expected an indented block
You'll get this error whenever your Python whitespace is out of whack. (If you've studied JavaScript, think of improper whitespace as improper use of ;
or {}
.) When your punctuation's off, your meaning can change entirely:
The peasant said, "The witch turned me into a newt!"
"The peasant," said the witch, "turned me into a newt!"
See what we mean?