您的位置:首页 > 其它

Whitespace Means Right Space

2013-04-01 23:04 176 查看
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?

INSTRUCTIONS

Properly indent the code to the right by hitting the spacebar key on your keyboard four times on line
2 (before
eggs
)
and another four times on line 3(before
return
).
Click "run" once you've done this.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: