用python玩轉(zhuǎn)數(shù)據(jù) - python學(xué)習(xí)筆記 (1)

Python mooc?之玩轉(zhuǎn)數(shù)據(jù)

Introductions

Key words

Import keyword?

Print(keyword.kwlist)

賦值語(yǔ)句

1)?不需要顯示聲明师崎,根據(jù)值來(lái)確定類型

2)?以引用的方式賦值

Pythons?數(shù)據(jù)類型

布爾型:僅有兩個(gè)數(shù)值,分別是ture?和false?分別使用1,0儲(chǔ)存

序列類型:

運(yùn)算順序

算術(shù)運(yùn)算?

power > positive or negative value > multiply or divide > exact division> mode > plus or minus?

比較運(yùn)算

1)?數(shù)值比較按大小進(jìn)行比較

2)?字符串按照ascii?碼值大小比較

邏輯運(yùn)算

-not /and /or. Have the first priorities?

The overall priorities(calculation) of calculation

Module, packages, library?

Module :

Import modulename ( import single module)

Import modulename1, modulename2, ……(import multiple modules)

Or?

From module1 import moduleElement?

Package?

One package consists a large numbers of modules?


Library?

One library consists of lots of packages?


Module 1

條件

If?語(yǔ)句

Sentence:

If expressions: ( expression means the judgement condition )

?Expre_ture_suite ( this means the actions need to carry out when the satisfy the condition)


e.g?

if sd1==sd2

?print(“the square’s are is “, sd1*sd2)


else

if expression:

?expr_true_suite

else:

?expr_ture_suite


e.g?

sd1=int(input(“the first side:”))

sd2=int(input(“the second side:”))

if sd1==sd2:

?print(“ the sqaure’s area is “, sd1*sd2)

else:

?print(“the rectangle’s area is”, sd1*sd2)


elif (multiple condition, multiple assumptions)

sentences :


if expression:

?expr_true_suite

elif expression2:

?expre2_ture_suite?

elif expressionN?:

?exprN_ture_suite

else?:

?none_of_the_above_s (when the value cannot satisfy any condition above, run this sentence)


e.g?


條件嵌套 (?the sequence of running conditional sentence)

e.g?

range () [function]

Range(start, end, step)

Not indicate the start, it will be automatically stars from 0

Not indicate the step, it will be automatically be 1

NB: the list of numbers do not include the end value, but it include the stared number?

e.g?

range(1,6, 1)

[1,2,3,4,5]

Cycle?

While?

While expression:

?Suite_to_repeat

This cycle also can be understand as not-satisfy-end cycle, which means when the value not longer satisfy expression, this cycle stop.


e.g?

sumA=0

j=1

while j<10:

?sumA+=j

?j+=1?

sumA

?

for?

for iter_var in iterable_object:

?suite_to_repeat

The break, continue and else in the cycle?

Break?

Break terminate the cycle, and turn to run the next sentence?

e.g?

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末梗醇,一起剝皮案震驚了整個(gè)濱河市北发,隨后出現(xiàn)的幾起案子臼节,更是在濱河造成了極大的恐慌积锅,老刑警劉巖江耀,帶你破解...
    沈念sama閱讀 222,729評(píng)論 6 517
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件屈张,死亡現(xiàn)場(chǎng)離奇詭異擒权,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)阁谆,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,226評(píng)論 3 399
  • 文/潘曉璐 我一進(jìn)店門碳抄,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人场绿,你說(shuō)我怎么就攤上這事剖效。” “怎么了焰盗?”我有些...
    開(kāi)封第一講書人閱讀 169,461評(píng)論 0 362
  • 文/不壞的土叔 我叫張陵璧尸,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我熬拒,道長(zhǎng)爷光,這世上最難降的妖魔是什么? 我笑而不...
    開(kāi)封第一講書人閱讀 60,135評(píng)論 1 300
  • 正文 為了忘掉前任澎粟,我火速辦了婚禮蛀序,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘捌议。我一直安慰自己哼拔,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 69,130評(píng)論 6 398
  • 文/花漫 我一把揭開(kāi)白布瓣颅。 她就那樣靜靜地躺著倦逐,像睡著了一般。 火紅的嫁衣襯著肌膚如雪宫补。 梳的紋絲不亂的頭發(fā)上檬姥,一...
    開(kāi)封第一講書人閱讀 52,736評(píng)論 1 312
  • 那天,我揣著相機(jī)與錄音粉怕,去河邊找鬼健民。 笑死,一個(gè)胖子當(dāng)著我的面吹牛贫贝,可吹牛的內(nèi)容都是我干的秉犹。 我是一名探鬼主播蛉谜,決...
    沈念sama閱讀 41,179評(píng)論 3 422
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼崇堵!你這毒婦竟也來(lái)了型诚?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書人閱讀 40,124評(píng)論 0 277
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤鸳劳,失蹤者是張志新(化名)和其女友劉穎狰贯,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體赏廓,經(jīng)...
    沈念sama閱讀 46,657評(píng)論 1 320
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡涵紊,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,723評(píng)論 3 342
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了幔摸。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片摸柄。...
    茶點(diǎn)故事閱讀 40,872評(píng)論 1 353
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖抚太,靈堂內(nèi)的尸體忽然破棺而出塘幅,到底是詐尸還是另有隱情,我是刑警寧澤尿贫,帶...
    沈念sama閱讀 36,533評(píng)論 5 351
  • 正文 年R本政府宣布电媳,位于F島的核電站,受9級(jí)特大地震影響庆亡,放射性物質(zhì)發(fā)生泄漏匾乓。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 42,213評(píng)論 3 336
  • 文/蒙蒙 一又谋、第九天 我趴在偏房一處隱蔽的房頂上張望拼缝。 院中可真熱鬧,春花似錦彰亥、人聲如沸咧七。這莊子的主人今日做“春日...
    開(kāi)封第一講書人閱讀 32,700評(píng)論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)继阻。三九已至,卻和暖如春废酷,著一層夾襖步出監(jiān)牢的瞬間瘟檩,已是汗流浹背。 一陣腳步聲響...
    開(kāi)封第一講書人閱讀 33,819評(píng)論 1 274
  • 我被黑心中介騙來(lái)泰國(guó)打工澈蟆, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留墨辛,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 49,304評(píng)論 3 379
  • 正文 我出身青樓趴俘,卻偏偏與公主長(zhǎng)得像睹簇,于是被迫代替她去往敵國(guó)和親奏赘。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,876評(píng)論 2 361

推薦閱讀更多精彩內(nèi)容