W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
現(xiàn)在,你應(yīng)該明白這本書的模式是用做很多的練習(xí)來教會(huì)你新知識(shí)。我以你可能不明白的代碼開始教學(xué),然后在用更多的習(xí)題去解釋一些概念。即使你現(xiàn)在并不明白,經(jīng)過大量的練習(xí)之后你也能明白了。記錄你不明白的地方,然后堅(jiān)持做練習(xí)題,你會(huì)收獲更多。
# Here's some new strange stuff, remember type it exactly.
days = "Mon Tue Wed Thu Fri Sat Sun"
months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"
print "Here are the days: ", days
print "Here are the months: ", months
print """
There's something going on here.
With the three double-quotes.
We'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
"""
$ python ex9.py
Here are the days: Mon Tue Wed Thu Fri Sat Sun
Here are the months: Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
There's something going on here.
With the three double-quotes.
We'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
- 自己檢查結(jié)果,記錄你犯過的錯(cuò)誤,并且在下個(gè)練習(xí)中盡量不犯同樣的錯(cuò)誤。
\n
來換行的時(shí)候,%r
就不生效了?這就是
%r
格式的工作原理;你如何輸入的,它就如何打印輸出。
你應(yīng)該這樣寫
"""
而不是" " "
,意思是說每兩個(gè)雙引號(hào)之間不能有空格。
在編程初期,大部分錯(cuò)誤都是一些簡單的錯(cuò)誤,比如拼寫問題,錯(cuò)別字,或者是將簡單的事情搞砸。這很正常,不用擔(dān)心,但是也要盡量不犯相同的錯(cuò)誤。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: