




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、精選優(yōu)質(zhì)文檔-傾情為你奉上Chapter 4 Selections1.<, <=, =, !=, >, >= 2.Yes. i becomes 1, j becomes 0, b1 becomes True, and b2 becomes Flase.3. random.randrange(0, 20) or random.randint(0, 19)4.random.randrange(10, 20) or random.randint(10, 19)5.random.randrange(10, 50 + 1) or random.randint(10, 50)6.r
2、andom.randrange(0, 2) or random.randint(0, 1) 7.if y > 0: x = 18.if score > 90: pay *= 1.039.if score > 90: pay *= 1.03else: pay *= 1.0110.If number is 30, (a) displays 30 is even30 is odd(b) displays 30 is evenIf number is 35, (a) displays 35 is odd(b) displays 35 is odd11.Note: else match
3、es the second if clause. The output is “x is 3” if x = 3 and y = 2. The output is “z is 7” if if x = 3 and y = 4. No output if if x = 2 and y = 2.12. Note: else matches the first if clause. The output is “x is 2” if x = 2 and y = 4. No output if if x = 3 and y = 2. The output is “z is 6” if if x = 3
4、 and y = 3.13. Consider score is 90, what will be the grade? The conditions are tested in the wrong orders.14. (A) and (C) are equivalent. (B) and (D) are incorrectly indented.15.newLine = (count % 10 = 0)16.Both are correct. (B) is better. Both conditions in (A) are tested. In (B) the condition is
5、tested only once.17.For number is 14, (a) displays:14 is even(b) displays14 is evenFor number is 15, (a) displays:15 is multiple of 5(b) displays15 is multiple of 5For number is 30, (a) displays:30 is even30 is multiple of 5(b) displays30 is even18.Yes19.This program will have a runtime error, becau
6、se tax will not be created.20.(true) and (3 > 4)Falsenot(x > 0) and (x > 0)False(x > 0) or (x < 0)True(x != 0) or (x = 0)True(x >= 0) or (x < 0)True(x != 1) = not (x = 1)True21.(x > 1) and (x < 100)22.(x > 1) and (x < 100) or (x < 0) 23.x >= y >= 0 Falsex &l
7、t;= y >= 0Truex != y = 5True(x != 0) or (x = 0)True 24.Yes 25.If ch is 'A', the expression is true;If ch is 'p', the expression is false;If ch is 'E', the expression is true;If ch is '5', the expression is false;26.(x < y and y < z) is True(x < y or y
8、 < z) is Truenot (x < y) is False(x < y < z) is Truenot (x < y < z) is False27. age > 13 and age < 1828.weight > 50 or height > 160.29.weight > 50 and height > 160.30.(weight > 50 or height > 160) and not (weight > 50 and height > 160) 31.Sorted32. tic
9、ketPrice = 20 if (ages >= 16) else 10print(count, end = "n" if count % 10 = 0 else " ")33.A:if x > 10: score = 3 * scaleelse: score = 4 * scaleB:if income > 10000: tax = income * 0.2else: tax = income * 0.17 + 1000C:if number % 3 = 0: print(i)else: print(j) 34.The precedence order of the Boolean operators are
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 寵物飲水機(jī)行業(yè)趨勢預(yù)測報(bào)告
- 企業(yè)采購成本控制方法論
- 國內(nèi)外環(huán)氧樹脂行業(yè)對(duì)比分析報(bào)告
- 綠色能源發(fā)展背景下海洋工程裝備行業(yè)發(fā)展趨勢研究
- 區(qū)塊鏈文化應(yīng)用案例分享行業(yè)發(fā)展前瞻預(yù)測
- 幼兒園中秋獻(xiàn)禮活動(dòng)方案
- 幼兒踏春活動(dòng)策劃方案
- 幼兒自卑教育活動(dòng)方案
- 年末教師聚餐活動(dòng)方案
- 幼兒入廁教研活動(dòng)方案
- MFP無機(jī)硅聲能凝膠施工方案
- 天棚簾施工方案
- 籃球課程思政課程設(shè)計(jì)
- 國家開放大學(xué)本科《商務(wù)英語4》一平臺(tái)機(jī)考真題及答案(第三套)
- 房屋買賣合同范本官方版模板電子版
- 傳統(tǒng)文化與生態(tài)文明建設(shè)智慧樹知到期末考試答案章節(jié)答案2024年云南大學(xué)
- 廣東省佛山市南海區(qū)2021-2022學(xué)年八年級(jí)下學(xué)期期末數(shù)學(xué)試題
- JT-T-1302.1-2019機(jī)動(dòng)車駕駛員計(jì)時(shí)培訓(xùn)系統(tǒng)第1部分:計(jì)時(shí)終端技術(shù)要求
- 江蘇省泰州市興化市2023-2024學(xué)年七年級(jí)下學(xué)期期末數(shù)學(xué)試題
- 2024年北京市中考數(shù)學(xué)真題試卷及答案
- 2024年浙江省杭州市蕭山區(qū)事業(yè)單位招考高頻考題難、易錯(cuò)點(diǎn)模擬試題(共500題)附帶答案詳解
評(píng)論
0/150
提交評(píng)論