国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

整理Python中的賦值運算符

2019-11-25 17:29:09
字體:
供稿:網(wǎng)友

下表列出了所有Python語言支持的賦值運算符。假設(shè)變量a持有10和變量b持有20,則:

2015513121006816.jpg (592×562)

 例如:

試試下面的例子就明白了所有在Python編程語言可供選擇的賦值運算符:

#!/usr/bin/pythona = 21b = 10c = 0c = a + bprint "Line 1 - Value of c is ", cc += aprint "Line 2 - Value of c is ", c c *= aprint "Line 3 - Value of c is ", c c /= a print "Line 4 - Value of c is ", c c = 2c %= aprint "Line 5 - Value of c is ", cc **= aprint "Line 6 - Value of c is ", cc //= aprint "Line 7 - Value of c is ", c

當(dāng)執(zhí)行上面的程序,它會產(chǎn)生以下結(jié)果:

Line 1 - Value of c is 31Line 2 - Value of c is 52Line 3 - Value of c is 1092Line 4 - Value of c is 52Line 5 - Value of c is 2Line 6 - Value of c is 2097152Line 7 - Value of c is 99864

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 横峰县| 临江市| 新野县| 黎城县| 常山县| 连山| 麟游县| 镶黄旗| 海原县| 尤溪县| 凤冈县| 三原县| 济源市| 沧源| 定日县| 凤翔县| 泸西县| 沂南县| 老河口市| 濮阳县| 临沭县| 韶山市| 昔阳县| 保靖县| 中宁县| 合阳县| 武功县| 三穗县| 宝兴县| 枣强县| 长白| 玛纳斯县| 曲麻莱县| 易门县| 东至县| 晋中市| 阿城市| 安宁市| 玉门市| 博湖县| 安宁市|