{"id":185740,"student_id":10,"content":"{\"html\":\"\u003c!DOCTYPE html\u003e\\n\u003chtml lang=\\\"en\\\"\u003e\\n\u003chead\u003e\\n \u003cmeta charset=\\\"UTF-8\\\"\u003e\\n \u003cmeta name=\\\"robots\\\" content=\\\"noindex, nofollow\\\"\u003e\\n \u003cmeta name=\\\"googlebot\\\" content=\\\"noindex, nofollow\\\"\u003e\\n \u003cmeta name=\\\"viewport\\\" content=\\\"width=device-width, initial-scale=1.0\\\"\u003e\\n \u003ctitle\u003eDocument\u003c/title\u003e\\n \u003clink rel=\\\"stylesheet\\\" href=\\\"https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css\\\"\u003e\\n \u003clink rel=\\\"stylesheet\\\" href=\\\"./index.css\\\"\u003e\\n \\n \u003cscript src=\\\"https://cdn.jsdelivr.net/npm/vue/dist/vue.js\\\"\u003e\u003c/script\u003e\\n \\n\u003c/head\u003e\\n\u003cbody\u003e\\n\\n \u003cdiv id=\\\"app\\\"\u003e\\n \u003cdiv class=\\\"navbar\\\"\u003e\\n \u003ch2\u003e試題{{index + 1}} (共{{exam.length}}題)\u003c/h2\u003e\\n \u003cspan\u003e剩餘時間 00:00:00\u003c/span\u003e\\n \u003c/div\u003e\\n \u003cdiv class=\\\"content\\\"\u003e\\n \u003cdiv class=\\\"p-4 content-description\\\"\u003e\\n \u003cpre\u003e{{current.description}}\u003c/pre\u003e\\n \u003c/div\u003e\\n \u003cdiv class=\\\"content-editors p-4\\\"\u003e\\n \u003c!-- 是非題 --\u003e\\n \u003cmy-true-or-false-exam \\n v-if=\\\"current.type === TRUE_OR_FALSE\\\"\\n :exam=\\\"current\\\"\\n \u003e\u003c/my-true-or-false-exam\u003e\\n\\n \u003c!-- 拖拉配對題 --\u003e\\n \u003cmy-drap-and-drop-exam\\n v-if=\\\"current.type === DROG_AND_DROP\\\"\\n :exam=\\\"current\\\"\\n \u003e\u003c/my-drap-and-drop-exam\u003e\\n\\n \u003c!-- 下拉選單題 --\u003e\\n \u003cmy-select-exam\\n v-if=\\\"current.type === SELECT\\\"\\n :exam=\\\"current\\\"\\n \u003e\u003c/my-select-exam\u003e\\n\\n \u003c!-- 單選題/多選題 --\u003e\\n \u003cmy-options-exam\\n v-if=\\\"current.type === OPTIONS\\\"\\n :exam=\\\"current\\\"\\n \u003e\u003c/my-options-exam\u003e \\n \u003c/div\u003e\\n \u003c/div\u003e\\n \u003cdiv class=\\\"footer d-flex justify-content-end\\\"\u003e\\n \u003cdiv class=\\\"p-2\\\"\u003e\\n \u003cbutton class=\\\"btn btn-lg btn-warning\\\" @click=\\\"toggleFullscreen\\\"\u003e\\n 進入/取消 全螢幕\\n \u003c/button\u003e\\n \u003c/div\u003e\\n \u003cdiv class=\\\"p-2\\\"\u003e\\n \u003cbutton class=\\\"btn btn-lg btn-primary\\\" @click=\\\"prev\\\" :disabled=\\\"isFirst\\\"\u003e\\n 上一題\\n \u003c/button\u003e\\n \u003c/div\u003e\\n \u003cdiv class=\\\"p-2\\\"\u003e\\n \u003cbutton class=\\\"btn btn-lg btn-primary\\\" @click=\\\"next\\\" :disabled=\\\"isLast\\\"\u003e\\n 下一題\\n \u003c/button\u003e\\n \u003c/div\u003e\\n \u003c/div\u003e\\n \u003c/div\u003e\\n\u003c/body\u003e\\n\u003c/html\u003e\",\"css\":\":root {\\n --navbar-height: 50px;\\n font-family: monospace;\\n}\\n\\nbody {\\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;\\n color: #555;\\n background-color: #eeeeee;\\n}\\n\\n#app {\\n position: absolute;\\n top: 5px;\\n left: 5px;\\n right: 5px;\\n bottom: 5px;\\n background-color: #eeeeee;\\n}\\n\\n#app .navbar {\\n position: absolute;\\n top: 0;\\n height: var(--navbar-height);\\n width: 100%;\\n \\n}\\n\\n#app .content {\\n position: absolute;\\n top: var(--navbar-height);\\n width: 100%;\\n height: calc(100vh - 10px - var(--navbar-height)*2);\\n box-sizing: border-box;\\n border: 2px solid #ccc;\\n background-color: #ffffff;\\n}\\n\\n#app .footer {\\n position: absolute;\\n bottom: 0;\\n height: var(--navbar-height);\\n width: 100%; \\n}\\n\\n.content .content-description {\\n border: 1px solid #ccc;\\n height: 40%;\\n width: 100%;\\n position: absolute;\\n top: 0;\\n overflow-y: scroll;\\n}\\n\\n.content .content-editors {\\n border: 1px solid #ccc;\\n height: 60%;\\n width: 100%;\\n position: absolute;\\n bottom: 0;\\n overflow-y: scroll;\\n}\\n\\n.drag_and_drop_select {\\n display: inline-block;\\n position: relative;\\n min-width: 100px;\\n min-height: 40px;\\n}\\n\\n.drag_and_drop_select \u003e span {\\n \\n}\\n\\n.drag_and_drop_select \u003e select {\\n position: absolute;\\n top: 0;\\n left: 0;\\n z-index: 1;\\n width: 15px;\\n height: 20px;\\n transform: translateY(-10px);\\n}\",\"js\":\"const OPTIONS = 'options' //選擇題\\nconst SELECT = 'select' //下拉選單題\\nconst TRUE_OR_FALSE = 'tureOrFalse' //是非題\\nconst DROG_AND_DROP = 'dragAndDrop' //配對題\\n\\nconst OPTION_SPLITER = '\u003c%==========%\u003e'\\nconst CONTENT_SELECTER = 'CONTENT_SELECTER'\\n\\nconst TYPES = { OPTIONS, SELECT, TRUE_OR_FALSE, DROG_AND_DROP }\\n\\nconst MODE_TEST = 'modeTest'\\nconst MODE_SHOW_RESULT = 'modeShowResult'\\nconst MODE_SHOW_ALL = 'modeShowAll'\\nconst A_TO_Z = 'ABCDEFGHIJKLMNOPQRSTUVWZYZ'\\n\\nVue.component('my-options-exam', {\\n template: `\\n \u003cdiv\u003e\\n \u003ch4\u003e回答區\u003c/h4\u003e\\n \u003cdiv v-for=\\\"option, index in exam.options\\\" class=\\\"p-2 my-1 alert\\\" :class=\\\"{'alert-danger': !checkOption(index)}\\\"\u003e\\n \u003cdiv class=\\\"d-inline-block align-top\\\"\u003e\\n \u003cinput type=\\\"checkbox\\\" :checked=\\\"exam.answer.includes(index)\\\" v-model=\\\"answer\\\" :value=\\\"index\\\"\u003e\\n \u003cspan class=\\\"px-2\\\"\u003e{{AZ[index]}}.\u003c/span\u003e\\n \u003c/div\u003e\\n \u003cpre class=\\\"d-inline-block m-0\\\"\u003e{{option}}\u003c/pre\u003e\\n \u003cp v-if=\\\"!checkOption(index)\\\"\u003e錯誤!\u003c/p\u003e\\n \u003c/div\u003e\\n \u003c/div\u003e\\n `,\\n props: ['exam'],\\n data () {\\n return {\\n AZ: A_TO_Z,\\n answer: JSON.parse(JSON.stringify(this.exam.answer)),\\n }\\n },\\n watch: {\\n exam(val, oldVal) {\\n this.answer = JSON.parse(JSON.stringify(this.exam.answer))\\n }\\n },\\n methods: {\\n checkOption(index) {\\n return this.exam.answer.includes(index) === this.answer.includes(index)\\n },\\n }\\n})\\n\\nVue.component('my-true-or-false-exam', {\\n template: `\\n \u003cdiv\u003e\\n \u003ch4\u003e回答區\u003c/h4\u003e\\n \u003cdiv class=\\\"alert\\\" v-for=\\\"option, index in exam.options\\\" :class=\\\"{'alert-danger': !checkOption(index)}\\\"\u003e\\n \u003cpre class=\\\"d-inline\\\"\u003e{{option}}\u003c/pre\u003e\\n \u003cinput type=\\\"radio\\\" :name=\\\"index\\\" value=\\\"yes\\\" :checked=\\\"exam.answer[index] == 'yes'\\\" v-model=\\\"answer[index]\\\"/\u003e\u003cspan\u003eYES\u003c/span\u003e\\n \u003cinput type=\\\"radio\\\" :name=\\\"index\\\" value=\\\"no\\\" :checked=\\\"!exam.answer[index] == 'no'\\\" v-model=\\\"answer[index]\\\"/\u003e\u003cspan\u003eNO\u003c/span\u003e\\n \u003cspan v-if=\\\"!checkOption(index)\\\"\u003e錯誤!\u003c/span\u003e\\n \u003c/div\u003e\\n \u003c/div\u003e\\n `,\\n props: ['exam'],\\n data () {\\n return {\\n AZ: A_TO_Z,\\n answer: JSON.parse(JSON.stringify(this.exam.answer))\\n }\\n },\\n watch: {\\n exam(val, oldVal) {\\n this.answer = JSON.parse(JSON.stringify(this.exam.answer))\\n }\\n },\\n methods: {\\n checkOption (idx) {\\n return this.exam.answer[idx] === this.answer[idx]\\n }\\n }\\n})\\n\\nVue.component('my-drap-and-drop-exam', {\\n template: `\\n \u003cdiv class=\\\"row\\\"\u003e\\n \u003cdiv class=\\\"col-6 border py-4\\\"\u003e\\n \u003ch4\u003e程式碼片段\u003c/h4\u003e\\n \u003ctemplate v-for=\\\"option, idx in exam.options\\\"\u003e\\n \u003ch5\u003e選項{{AZ[idx]}}\u003c/h5\u003e\\n \u003cpre class=\\\"alert alert-secondary p-2\\\"\u003e{{option}}\u003c/pre\u003e\\n \u003c/template\u003e\\n \u003c/div\u003e\\n \u003cdiv class=\\\"col-6 border py-4\\\"\u003e\\n \u003ch4\u003e回答區\u003c/h4\u003e\\n \u003cpre\u003e\\n \u003ctemplate v-for=\\\"line in exam.content\\\"\u003e\\n \u003cspan v-if=\\\"typeof line === 'string'\\\"\u003e\\n {{line}}\\n \u003c/span\u003e\\n \u003cspan v-if=\\\"typeof line === 'object'\\\" class=\\\"alert alert-success drag_and_drop_select\\\" :class=\\\"{'alert-danger': !checkOption(line.idx)}\\\"\u003e\\n \u003cspan\u003e{{exam.options[answer[line.idx]]}}\u003c/span\u003e\\n \u003cselect v-model=\\\"answer[line.idx]\\\" class=\\\"custom-select\\\"\u003e\\n \u003coption v-for=\\\"option, option_idx in line\\\" :value=\\\"option_idx\\\"\u003e\\n 選項{{AZ[option_idx]}}\\n \u003c/option\u003e\\n \u003c/select\u003e\\n \u003c/span\u003e\\n \u003c/template\u003e\\n \u003c/pre\u003e\\n \u003c/div\u003e\\n \u003c/div\u003e\\n `.replace(/ *\\\\n */g, ''),\\n\\n props: ['exam'],\\n\\n data () {\\n return {\\n AZ: A_TO_Z,\\n answer: JSON.parse(JSON.stringify(this.exam.answer))\\n }\\n },\\n watch: {\\n exam(val, oldVal) {\\n this.answer = JSON.parse(JSON.stringify(this.exam.answer))\\n }\\n },\\n methods: {\\n checkOption (idx) {\\n return this.exam.answer[idx] === this.answer[idx]\\n }\\n }\\n})\\n\\nVue.component('my-select-exam', {\\n template: `\\n \u003cpre\u003e\\n \u003ch4\u003e回答區\u003c/h4\u003e\\n \u003ctemplate v-for=\\\"(line, idx) in exam.content\\\"\u003e\\n \u003cspan v-if=\\\"typeof line === 'string'\\\"\u003e{{line}}\u003c/span\u003e\\n \u003cselect class=\\\"p-1 alert alert-success\\\" v-if=\\\"typeof line === 'object'\\\" v-model=\\\"answer[line.idx]\\\" :class=\\\"{'alert-danger': !checkOption(line.idx)}\\\"\u003e\\n \u003coption v-for=\\\"option, idx in line\\\" :value=\\\"idx\\\" :selected=\\\"idx == line.answer\\\"\u003e\\n {{option}}\\n \u003c/option\u003e\\n \u003c/select\u003e\\n \u003cspan class=\\\"px-2 text-danger\\\" v-if=\\\"!checkOption(line.idx)\\\"\u003e錯誤!\u003c/span\u003e\\n \u003c/template\u003e\\n \u003c/pre\u003e\\n `.replace(/ *\\\\n */g, ''),\\n\\n props: ['exam'],\\n \\n data () {\\n return {\\n answer: JSON.parse(JSON.stringify(this.exam.answer))\\n }\\n },\\n \\n watch: {\\n exam(val, oldVal) {\\n this.answer = JSON.parse(JSON.stringify(this.exam.answer))\\n }\\n },\\n \\n methods: {\\n checkOption (idx) {\\n return this.exam.answer[idx] === this.answer[idx]\\n }\\n }\\n})\\n\\nconst DATA = []\\nlet q = undefined\\n\\n// example\\n// q = {}\\n// q.type = OPTIONS\\n// q.description = ``\\n// q.options = ``\\n// q.content = ``\\n// q.answer = {}\\n// DATA.push(q)\\n\\n//1\\nq = {}\\nq.type = DROG_AND_DROP\\nq.description = `\\n您正在創建一個 Python 腳本來執行輸入並檢查大寫和小寫。\\n\\n你應該使用哪四個程式碼片段來開發解決方案?回答時,請將適合的程式碼片段從程式碼片段清單移動到回答區,並按正確的順序排列\\n`\\nq.options = `\\nelif name.upper() == name:\\n print(name,\\\"是全部大寫.\\\")\\n${OPTION_SPLITER}\\nname = input(\\\"輸入你的英文名字:\\\")\\n${OPTION_SPLITER}\\nelse :\\n print(name,\\\"是大小寫混合.\\\")\\n${OPTION_SPLITER}\\nif name.lower() == name:\\n print(name,\\\"是全部小寫.\\\")\\n${OPTION_SPLITER}\\nelse:\\n print(name,\\\"是大寫.\\\")\\n${OPTION_SPLITER}\\nelse:\\n print(name,\\\"是小寫.\\\")\\n`\\nq.content = `\\n${CONTENT_SELECTER}\\n${CONTENT_SELECTER}\\n${CONTENT_SELECTER}\\n${CONTENT_SELECTER}\\n`\\nq.answer = [1, 3, 0, 2]\\nDATA.push(q)\\n\\n\\n\\n//2\\nq = {}\\nq.type = DROG_AND_DROP\\nq.description = `\\n您正在構建一個Python程式,它將顯示從2到100中的所有質數。\\n\\n你要如何完成程式碼?回答時,請將適合的程式碼片段拖動到正確的位置。每個程式碼片段都可以使用一次,多次,或者不使用。你可能需要在窗格之間拖動分欄的寬度或捲動位置來查看內容。\\n\\n注意:每個正確的選擇都可獲得一分。\\n`\\nq.options = `\\np = 2\\nwhile p \u003c= 100:\\n is_prime = True\\n${OPTION_SPLITER}\\np = 2\\nis_prime = True\\nwhile p \u003c= 100:\\n${OPTION_SPLITER}\\nbreak\\n${OPTION_SPLITER}\\ncontinue\\n${OPTION_SPLITER}\\np = p + 1\\n${OPTION_SPLITER}\\nfor i in range(2, p):\\n if p /i == 0:\\n is_prime = False\\n${OPTION_SPLITER}\\nfor i in range (2, p):\\n if p % i == 0:\\n is_prime = False\\n`\\nq.content = `\\n${CONTENT_SELECTER}\\n ${CONTENT_SELECTER}\\n ${CONTENT_SELECTER}\\n if is_prime == True:\\n print(p)\\n ${CONTENT_SELECTER}\\n\\n`\\nq.answer = { 0: 0, 1: 6, 2: 2, 3: 4 }\\nDATA.push(q)\\n\\n\\n//3\\nq = {}\\nq.type = SELECT\\nq.description = `\\n你正在編寫一個Python程式去驗證員工編號。\\n\\n員工編號的格式必須為ddd-dd-dddd,並且只包含數字和破折號。如果格式正確,則程式必須列印True,如果格式不正確,則列印 False。\\n你要如何完成這段程式碼?回答時,在回答區選擇適當的程式碼片段。\\n`\\nq.options = `\\nemployee_number = \\\"\\\"\\nemployee_number = \\\"sentinel\\\"\\n${OPTION_SPLITER}\\nwhile employee_number != \\\"\\\":\\nwhile employee_number != \\\"sentinel\\\":\\n${OPTION_SPLITER}\\nvalid = False\\nvalid = True\\n${OPTION_SPLITER}\\nvalid = False\\nvalid = True\\n`\\nq.content = `\\n${CONTENT_SELECTER}\\nparts = \\\"\\\"\\n${CONTENT_SELECTER}\\n ${CONTENT_SELECTER}\\n employee_number = input(\\\"輸入員工編號(ddd-dd-dddd): \\\")\\n parts = employee_number . split('-')\\n if len(parts)== 3:\\n if len(parts[0]) == 3 and len(parts[1]) == 2 and len(parts[2]) == 4:\\n if parts[0].isdigit() and parts[1].isdigit() and parts[2].isdigit():\\n ${CONTENT_SELECTER}\\nprint(valid)\\n`\\nq.answer = { 0: 0, 1: 1, 2: 0, 3: 1 }\\nDATA.push(q)\\n\\n\\n// 4\\nq = {}\\nq.type = SELECT\\nq.description = `\\n你為一家為所有年齡發行媒體的公司工作。\\n\\n你正在編寫一個根據使用者的年齡進行分級的函數。這個函數必須滿足以下要求:\\n\\n任何 18 歲或以上的人都會收到\\\"A\\\"的分級。\\n任何 13 歲或以上,但小於 18 歲的人都會收到\\\"T\\\"的分級。\\n任何12歲或更年輕的人都會收到\\\"C\\\"的分級。\\n如果年齡未知,則設定為\\\"C\\\"的分級。\\n\\n您需要完成代碼以滿足要求。\\n\\n你要如何完成這段程式碼?回答時,在回答區選擇適當的程式碼片段。\\n`\\nq.options = `\\nage \u003c 13:rating = \\\"C\\\"\\nage \u003c 18:rating = \\\"T\\\"\\n:rating = \\\"A\\\"\\nage == None:rating = \\\"C\\\"\\n${OPTION_SPLITER}\\nage \u003c 13:rating = \\\"C\\\"\\nage \u003c 18:rating = \\\"T\\\"\\n:rating = \\\"A\\\"\\nage == None:rating = \\\"C\\\"\\n${OPTION_SPLITER}\\nage \u003c 13:rating = \\\"C\\\"\\nage \u003c 18:rating = \\\"T\\\"\\n:rating = \\\"A\\\"\\nage == None:rating = \\\"C\\\"\\n${OPTION_SPLITER}\\nage \u003c 13:rating = \\\"C\\\"\\nage \u003c 18:rating = \\\"T\\\"\\n:rating = \\\"A\\\"\\nage == None:rating = \\\"C\\\"\\n\\n`\\nq.content = `\\ndef get_rating(age):\\n rating = \\\"\\\"\\n if${CONTENT_SELECTER}\\n elif${CONTENT_SELECTER}\\n elif${CONTENT_SELECTER}\\n else${CONTENT_SELECTER}\\n return rating\\n`\\nq.answer = { 0: 0, 1: 1, 2: 3, 3: 2 }\\nDATA.push(q)\\n\\n// 5\\nq = {}\\nq.type = SELECT\\nq.description = `\\n你正在使用Python編寫一個數學工具。\\n\\n你正在編寫一個函數來計算方根。\\n\\n這個函數必須滿足以下要求:\\n\\n如果 a 是非負數,則回傳a ** (1 / b)\\n如果 a 是負數且為偶數,則回傳\\\"結果是虛數\\\"\\n如果 a 是負數且為奇數,則回傳-(-a) ** (1 / b)\\n\\n你要如何完成這段程式碼?回答時,在回答區選擇適當的程式碼片段。\\n`\\nq.options = `\\nif a \u003e= 0:\\n${OPTION_SPLITER}\\nelse:\\n${OPTION_SPLITER}\\nif a % 2 == 0:\\n${OPTION_SPLITER}\\nelse:\\n`\\nq.content = `\\ndef safe_root(a,b):\\n ${CONTENT_SELECTER}\\n answer = a **(1 / b)\\n ${CONTENT_SELECTER}\\n ${CONTENT_SELECTER}\\n answer = \\\"結果是虛數\\\"\\n ${CONTENT_SELECTER}\\n answer = -(-a)**(1/b)\\n return answer\\n`\\nq.answer = { 0: 0, 1: 0, 2: 0, 3: 0 }\\nDATA.push(q)\\n\\n// 6\\nq = {}\\nq.type = SELECT\\nq.description = `\\n您正在為線上產品銷售公司開發Python應用程序。\\n\\n你需要該程式逐一查看產品清單,並在找到目標產品識別碼時進行跳脫的動作。\\n\\n你要如何完成這段程式嗎?回答時,在回答區選擇適當的程式碼片段。\\n\\n注意:每個正確的選擇都可獲得一分。\\n`\\nq.options = `\\nwhile\\nfor\\nif\\nbreak\\n${OPTION_SPLITER}\\nwhile\\nfor\\nif\\nbreak\\n${OPTION_SPLITER}\\ncontinue\\nbreak\\nindex += 1\\nindex = 1\\n`\\nq.content = `\\nproductIdList = [0,1,2,3,4,5,6,7,8,9]\\nindex = 0\\n${CONTENT_SELECTER}(index \u003c 10):\\n print(productIdList[index])\\n\\n if productIdList[index] == 6:\\n ${CONTENT_SELECTER}\\n else:\\n ${CONTENT_SELECTER}\\n`\\nq.answer = { 0: 0, 1: 3, 2: 2 }\\nDATA.push(q)\\n\\n\\n// 7\\nq = {}\\nq.type = SELECT\\nq.description = `\\n你正在設計一個決策結構來將學生的數字等級轉換為字母等級。這個程式必須按照下表中指定的字母等級分配:\\n\\n百分比範圍 =\u003e 字母等級\\n90 到 100 =\u003e A\\n80 到 90 =\u003e B\\n70 到 79 =\u003e C\\n65 到 69 =\u003e D\\n0 到 64 =\u003e F\\n\\n例如,如果使用者輸入 90,則輸出應該是\\\"您的字母等級為A。\\\",相同的,如果使用者輸入89則輸出應該為\\\"您的字母等級為 B。\\\"\\n\\n你要如何完成這段程式碼?回答時,在回答區選擇適當的程式碼片段。\\n`\\nq.options = `\\nif grade \u003c= 90:\\nif grade \u003e= 90:\\nelif grade \u003e 90:\\nelif grade \u003e= 90:\\n${OPTION_SPLITER}\\nif grade \u003e 80:\\nif grade \u003e= 80:\\nelif grade \u003e 80:\\nelif grade \u003e= 80:\\n${OPTION_SPLITER}\\nif grade \u003e 70:\\nif grade \u003e= 70:\\nelif grade \u003e 70:\\nelif grade \u003e= 70:\\n${OPTION_SPLITER}\\nif grade \u003e 65:\\nif grade \u003e= 65:\\nelif grade \u003e 65:\\nelif grade \u003e= 65:\\n`\\nq.content = `\\n#字母等級轉換器\\n\\ngrade = int(input(\\\"請輸入數字等級\\\"))\\n\\n${CONTENT_SELECTER}\\n letter_grade = 'A'\\n${CONTENT_SELECTER}\\n letter_grade = 'B'\\n${CONTENT_SELECTER}\\n letter_grade = 'C'\\n${CONTENT_SELECTER}\\n letter_grade = 'D'\\nelse:\\n letter_grade = 'F'\\n\\nprint(\\\"你的文字等級是:\\\",letter_grade)\\n`\\nq.answer = {0: 1, 1: 3, 2: 3, 3: 3}\\nDATA.push(q)\\n\\n// 8\\nq = {}\\nq.type = SELECT\\nq.description = `\\n你正在開發一個線上遊戲的Python應用程式。\\n\\n你需要創建符合以下條件的函數:\\n\\n函數名為 update_score\\n函數接收當前分數和一個值\\n函數將值添加到當前分數\\n函數返回新分數\\n\\n你要如何完成程式碼?回答時,請在回答區中選擇適當的程式碼片段。\\n`\\nq.options = `\\nupdate_score\\ndef update_score\\nreturn update_score\\n${OPTION_SPLITER}\\n(current,value):\\n():\\n(current,value)\\n()\\n${OPTION_SPLITER}\\npass current\\nreturn current\\nreturn\\npass\\n`\\nq.content = `\\n${CONTENT_SELECTER} ${CONTENT_SELECTER}\\n current += value\\n ${CONTENT_SELECTER}\\n`\\nq.answer = {0: 1, 1: 0, 2: 1}\\nDATA.push(q)\\n\\n// 9\\nq = {}\\nq.type = OPTIONS\\nq.description = `\\n你為公司開發Python應用程式。\\n\\n你希望在程式碼中添加注釋,以便其他團隊成員夠理解它。\\n\\n你應該麼做?\\n`\\nq.options = `\\n將注釋放在任何一行的 # 符號之後。\\n${OPTION_SPLITER}\\n將備註放在第一行程式碼之前,用空白行隔開。\\n${OPTION_SPLITER}\\n將注釋放在最後一行程式碼之後,用空行隔開。\\n${OPTION_SPLITER}\\n將注釋放在任何一行的括弧內。\\n`\\nq.content = ``\\nq.answer = [0]\\nDATA.push(q)\\n\\n// 10\\nq = {}\\nq.type = TRUE_OR_FALSE\\nq.description = `\\n你創建一個函數,透過使用Python計算數字的次方。\\n\\n你需要確保該函數有注釋。\\n\\n你創建以下程式碼。其中包括的行號只是做為參考\\n\\n01 # calc_power 函數計算指數\\n02 # x 是底\\n03 # y 是次方\\n04 # 返回 x 的 y 次方的值\\n05 def calc_power( x , y ):\\n06 comment = \\\"# 返回值\\\"\\n07 return x ** y #x的y次方\\n\\n針對下列每個敘述,如果該敘述是正確的就選擇Yes。否則請選擇No。\\n\\n`\\nq.options = `\\n01 到 04 行在語法檢查時將被忽略。\\n${OPTION_SPLITER}\\n02 和 03 行中的井字符號(#)非必填。\\n${OPTION_SPLITER}\\n06 行中的字串將被解釋為注釋。\\n${OPTION_SPLITER}\\n07 行包含內嵌注釋。\\n`\\nq.content = ``\\nq.answer = { 0: 'yes', 1: 'no', 2: 'no', 3: 'yes' }\\nDATA.push(q)\\n\\n// 11\\nq = {}\\nq.type = OPTIONS\\nq.description = `\\nAdventure Works Cycles公司正在創建一個程式,允許客戶在騎自行車時紀錄行駛的公里數。該程式將根據客戶日誌的公里數發送消息。\\n\\n你創建以下的Python程式碼。其中包含的行號只是做為參考。\\n\\n01 \\n02 name = input(\\\"你的名字是什麼?\\\")\\n03 return name\\n04 \\n05 calories = kms * calories_per_km\\n06 return calories\\n07 distance = int(input(\\\"你這週騎乘了多少公里數\\\"))\\n08 burn_rate = 50\\n09 biker = get_name()\\n10 calories_burned = calc_calories(distance, burn_rate)\\n11 print(biker,\\\",你燃燒了大約\\\",calories_burned,\\\"卡路里.\\\")\\n\\n你需要定義二個必要的函數。\\n\\n哪些程式碼片段你將使用在 01 及 04 行中?每個正確的答案都提供了部分的解決方案。請選擇二個。\\n`\\nq.options = `\\n01 def get_name():\\n${OPTION_SPLITER}\\n01 def get_name(biker):\\n${OPTION_SPLITER}\\n01 def get_name(name):\\n${OPTION_SPLITER}\\n04 def calc_calories():\\n${OPTION_SPLITER}\\n04 def calc_calories(kms,burn_rate):\\n${OPTION_SPLITER}\\n04 def calc_calories(kms,calories_per_km):\\n`\\nq.content = ``\\nq.answer = [0, 5]\\nDATA.push(q)\\n\\n// 12\\nq = {}\\nq.type = OPTIONS\\nq.description = `\\n你為公司開發Python應用程式。\\n\\n你需要接受來自使用者的輸入並將該資訊列印到使用者螢幕。\\n\\n你已開始使用以下程式碼。其中包含的行號只是做為參考。\\n\\n01 print(\\\"你的名字是什麼?\\\")\\n02\\n03 print(name)\\n\\n你應該在 02 行編寫哪個程式碼?\\n`\\nq.options = `\\ninput(name)\\n${OPTION_SPLITER}\\nname = input\\n${OPTION_SPLITER}\\ninput(\\\"name\\\")\\n${OPTION_SPLITER}\\nname = input()\\n`\\nq.content = ``\\nq.answer = [3]\\nDATA.push(q)\\n\\n// 13\\nq = {}\\nq.type = OPTIONS\\nq.description = `\\n你為你的學校開發了一個Python應用程式。\\n\\n你需要將資料讀寫到文字檔中。如果檔案不存在,則必須創建它,如果檔案具有內容,則必須刪除內容。\\n\\n你應該使用哪個程式碼?\\n`\\nq.options = `\\nopen(\\\"local_data\\\",\\\"w\\\")\\n${OPTION_SPLITER}\\nopen(\\\"local_data\\\",\\\"w+\\\")\\n${OPTION_SPLITER}\\nopen(\\\"local_data\\\",\\\"r\\\")\\n${OPTION_SPLITER}\\nopen(\\\"local_data\\\",\\\"r+\\\")\\n`\\nq.content = ``\\nq.answer = [0]\\nDATA.push(q)\\n\\n// 14\\nq = {}\\nq.type = OPTIONS\\nq.description = `\\n你正在編寫一個Python程式來自動化庫存。你的第一個任務是讀取庫存交易紀錄的檔案。該檔案包含前一天的銷售額,包括物料編號、價格和數量。\\n\\n下面顯示的是檔案中的資料範例:\\n\\n10 , 200 , 5\\n20 , 100 , 1\\n\\n程式碼中必須符合以下的需求:\\n\\n檔案的每一行都必須讀取和列印。\\n如果遇到空行,則必須忽略。\\n在完成所有行的讀取後,必須關閉檔案。\\n\\n你創建了以下的程式碼。其中包含的行號只是做為參考。\\n\\n01 inventory = open(\\\"inventory.txt\\\",\\\"r\\\")\\n02 eof=False\\n03 while rof == False:\\n04 line = inventory.readline()\\n05 \\n06 \\n07 print(line.strip())\\n08 else:\\n09 print(\\\"檔案結束\\\")\\n10 eof=True\\n11 inventory.close()\\n\\n在 05 及 06 行你應該編寫那些程式碼?\\n`\\nq.options = `\\n05 if line != '\\\\\\\\n':\\n06 if line != \\\"\\\":\\n${OPTION_SPLITER}\\n05 if line != '':\\n06 if line != \\\"\\\\\\\\n\\\":\\n${OPTION_SPLITER}\\n05 if line != '':\\n06 if line != \\\"\\\":\\n${OPTION_SPLITER}\\n05 if line != '\\\\\\\\n':\\n06 if line != None:\\n`\\nq.content = ``\\nq.answer = [1]\\nDATA.push(q)\\n\\n// 15\\nq = {}\\nq.type = SELECT\\nq.description = `\\nTailspin Toys 公司正在為員工建立一個籃球場,以提高公司士氣。\\n\\n你正在創建一個Python程式,員工可以使用它來記錄他們的平均得分。\\n\\n該程式必須允許使用者輸入他們的名字和當前分數。該程式將輸出使用者名和使用者的平均分數。輸出必須符合以下要求:\\n\\n使用者姓名必須是靠左對齊的。\\n如果使用者姓名少於20個字元,則必須在右側添加額外的空間。\\n平均分數必須有三個位置在小數點的左邊和一個位置在小數點右邊(XXX.X)。\\n\\n你要如何完成程式碼?回答時,請在回答區中選擇適當的程式碼片段。\\n\\n注意:每個正確的選擇都可獲得一分。\\n========================================\\n\\nname = input(\\\"你的名字是什麼?\\\")\\nscore = 0\\ncount = 0\\nsum = 0\\nwhile (score !=1):\\n`\\nq.options = `\\n%-20?\\n%-20d\\n%-20f\\n%-20s\\n${OPTION_SPLITER}\\n%1.5?\\n%5.1f\\n%5.1s\\n%1.5f\\n`\\nq.content = `\\nname = input(\\\"你的名字是什麼?\\\")\\nscore = 0\\ncount = 0\\nsum = 0\\nwhile (score !=1):\\n score = int(input(\\\"輸入你的分數:(輸入-1結束程式)\\\"))\\n if score == -1:\\n break\\n sum += score\\n count += 1\\naverage = sum / count\\nprint(\\\"${CONTENT_SELECTER},你的平均分數是:${CONTENT_SELECTER}\\\"%(name,average))\\n\\n`\\nq.answer = {0: 3, 1: 1}\\nDATA.push(q)\\n\\n// 16\\nq = {}\\nq.type = DROG_AND_DROP\\nq.description = `\\n你正在編寫一個處理檔案的函數。\\n\\n如果檔案不存在,則需要確保該函數返回None。如果該檔案確實存在,則該函數必須返回第一行的內容。\\n\\n你編寫以下的程式碼:\\n\\nimport os\\ndef get_first_line(filename)\\n\\n你應該如何安排這些程式碼片段的順序來完成函數?回答時,請將適合的程式碼片段從程式碼片段清單移動到回答區,並按正確的順序排列。\\n`\\nq.options = `\\nwith open(filename,'r') as file:\\n${OPTION_SPLITER}\\nelse:\\n${OPTION_SPLITER}\\n return file.readline()\\n${OPTION_SPLITER}\\n return None\\n${OPTION_SPLITER}\\nif os.path.isfile(filename):\\n`\\nq.content = `\\n${CONTENT_SELECTER}\\n${CONTENT_SELECTER}\\n${CONTENT_SELECTER}\\n${CONTENT_SELECTER}\\n${CONTENT_SELECTER}\\n`\\nq.answer = {0: 4, 1: 3, 2: 1, 3: 0, 4: 2}\\nDATA.push(q)\\n\\n// 17\\nq = {}\\nq.type = SELECT\\nq.description = `\\nBest For You 有機公司需要一個簡單的程式,話務中心將使用該程式輸入新的咖啡品種的調查資料。\\n\\n該程式必須接受輸入並返回基於五顆星規模的平均評等。輸出必須四捨五入到小數第二位。\\n\\n你必須完成這個程式碼以符合需求。\\n\\n你要如何完成這個程式碼?回答時,在回答區選擇適當的程式碼片段。\\n\\n注意:每個正確的選擇都可獲得一分。\\n`\\nq.options = `\\nprint(\\\"請輸入下一個評等(1-5),完成請輸入-1\\\")\\nfloat(input(\\\"請輸入下一個評等(1-5),完成請輸入-1\\\"))\\ninput(\\\"請輸入下一個評等(1-5),完成請輸入-1\\\")\\ninput\\\"請輸入下一個評等(1-5),完成請輸入-1\\\")\\n${OPTION_SPLITER}\\noutput(\\\"新咖啡的平均星級評等是:\\\"\\nconsole.input(\\\"新咖啡的平均星級評等是:\\\"\\nprintline(\\\"新咖啡的平均星級評等是:\\\"\\nprint(\\\"新咖啡的平均星級評等是:\\\"\\n${OPTION_SPLITER}\\nformat(average,'.2f'))\\nformat(average,'.2d'))\\n{average,'.2f'}\\nformat.average.{2d}\\n`\\nq.content = `\\nsum = count = don = 0\\naverage = 0.0\\n\\nwhile (done != -1):\\n rating = ${CONTENT_SELECTER}\\n\\n if rating == -1:\\n break\\n sum += rating\\n count +=1\\n\\naverage = float(sum / count)\\n\\n${CONTENT_SELECTER} + ${CONTENT_SELECTER}\\n`\\nq.answer = {0: 2, 1: 3, 2: 0}\\nDATA.push(q)\\n\\n// 18\\nq = {}\\nq.type = TRUE_OR_FALSE\\nq.description = `\\n在下列的語法敘述中,如果是正確的就選擇Yes,\\n否則請選擇No。\\n`\\nq.options = `\\n在try語法中可以有一個或多個except子句。\\n${OPTION_SPLITER}\\n在try語法中可以有一個沒有except子句的finally子句。\\n${OPTION_SPLITER}\\n在try語法中可以一個finally子句與except子句。\\n${OPTION_SPLITER}\\n在try語法中可以有一個或多個finally子句。\\n`\\nq.content = ``\\nq.answer = {0: 'yes', 1: 'yes', 2: 'yes', 3: 'no'}\\nDATA.push(q)\\n\\n// 19\\nq = {}\\nq.type = OPTIONS\\nq.description = `\\n在這個問題中需要你評估帶底線的文字已確定它是否敘述正確。\\n\\n你編寫一下程式碼:\\n\\nimport sys\\ntry:\\n file_in = open(\\\"in.txt\\\",'r')\\n file_out = open(\\\"out.txt\\\",'w+')\\nexcept IOError:\\n print('無法開啟',file_name)\\nelse:\\n i = 1\\n for line in file_in:\\n print(line.rstrip())\\n file_out.write(\\\"line \\\" + str(i) + \\\": \\\" + line)\\n i = i + 1\\n file_in.close()\\n file_out.close()\\n\\nout.txt檔不存在。你執行程式碼。「這個程式碼將執行而不出錯」!!\\n\\n再檢查帶底線的文字敘述。如果語法正確,請選擇\\\"不需要改變\\\"。如果語法不正確,請選擇語法正確的答案選項\\n`\\nq.options = `\\n不需要改變。\\n${OPTION_SPLITER}\\n程式碼執行,但產生邏輯錯誤。\\n${OPTION_SPLITER}\\n程式碼將產生執行階段錯誤。\\n${OPTION_SPLITER}\\n程式碼將產生語法錯誤。\\n`\\nq.content = ``\\nq.answer = [3]\\nDATA.push(q)\\n\\n// 20\\nq = {}\\nq.type = OPTIONS\\nq.description = `\\n你正在創建一個函數用來讀取資料檔案並且利印檔案的每一行。\\n\\n你編寫以下的程式碼。其中包含的行號只是做為參考。\\n\\n01 import os\\n02 def read_file(file):\\n03 line = None\\n04 if os.path.isfile(file):\\n05 data = open(file,'r')\\n06 while line != '':\\n07 line = data.readline()\\n08 print(line)\\n\\n即便檔案不存在,程式碼也會嘗試讀取這個檔案。\\n\\n你需要更正程式碼。\\n\\n哪三行有縮排問題?每個正確的答案都提供了部分的解決方案,請選擇三個。\\n`\\nq.options = `\\nLine 01\\n${OPTION_SPLITER}\\nLine 02\\n${OPTION_SPLITER}\\nLine 03\\n${OPTION_SPLITER}\\nLine 04\\n${OPTION_SPLITER}\\nLine 05\\n${OPTION_SPLITER}\\nLine 06\\n${OPTION_SPLITER}\\nLine 07\\n${OPTION_SPLITER}\\nLine 08\\n`\\nq.content = ``\\nq.answer = [5, 6, 7]\\nDATA.push(q)\\n\\n// 21\\nq = {}\\nq.type = SELECT\\nq.description = `\\n\\n你在評估以下程式碼時發現錯誤。其中包含的行號只是做為參考。\\n\\n01 numbers = [0,1,2,3,4,5,6,7,8,9]\\n02 index = 0\\n03 while (index \u003c 10)\\n04 print(numners[index])\\n05\\n06 if numbers(index) = 6\\n07 break\\n08 else:\\n09 index += 1\\n\\n你需要更正 03 行和 06 行中的程式碼。\\n\\n你要如何更正程式碼?根據程式碼片段中提供的資訊,使用下拉式功能表選擇每個問題的答案選項。\\n\\n注意:每個正確的選擇都可獲得一分。\\n`\\nq.options = `\\nwhile(index \u003c 10):\\nwhile[index \u003c10]\\nwhile(index \u003c5):\\nwhile[index \u003c5]\\n${OPTION_SPLITER}\\nif numbers[index] == 6\\nif numbers[index] == 6:\\nif numbers(index) = 6:\\nif numbers(index) != 6\\n`\\nq.content = `\\n在 03 行中應該使用哪個程式碼片段?\\n${CONTENT_SELECTER}\\n在 06 行中應該使用哪個程式碼片段?\\n${CONTENT_SELECTER}\\n`\\nq.answer = {0: 0, 1: 1}\\nDATA.push(q)\\n\\n// 22\\nq = {}\\nq.type = SELECT\\nq.description = `\\n你為你的公司開發一個Python應用程式。\\n\\n你編寫了以下的程式碼:\\n\\nnumList = [1,2,3,4,5]\\nalphaList = [\\\"a\\\",\\\"b\\\",\\\"c\\\",\\\"d\\\",\\\"e\\\"]\\nprint(numList is alphaList)\\nprint(numList == alphaList)\\nnumList = alphaList\\nprint(numList is alphaList)\\nprint(numList == alphaList)\\n\\n根據程式碼片段中提供的資訊,使用下拉選單選擇每個問題的答案選項。\\n`\\nq.options = `\\nTrue\\nFalse\\n${OPTION_SPLITER}\\nTrue\\nFalse\\n${OPTION_SPLITER}\\nTrue\\nFalse\\n${OPTION_SPLITER}\\nTrue\\nFalse\\n`\\nq.content = `\\n在第一次 print 後會顯示什麼? ${CONTENT_SELECTER}\\n在第二次 print 後會顯示什麼? ${CONTENT_SELECTER}\\n在第三次 print 後會顯示什麼? ${CONTENT_SELECTER}\\n在第四次 print 後會顯示什麼? ${CONTENT_SELECTER}\\n`\\nq.answer = {0: 1, 1: 1, 2: 0, 3: 0}\\nDATA.push(q)\\n\\n// 23\\nq = {}\\nq.type = SELECT\\nq.description = `\\nSouthridge Video 需要一種方法來決定客戶租用DVD的費用,該費用取決於DVD歸還的時間。然而,在週四和週日也有特別的費率。\\n\\n費用結構如下所示:\\n\\n費用是每晚1.59美元。\\n如果DVD在晚上8點後返還,則客戶將被收取額外一天的費用。\\n如果影片是在星期天租的,那麼客戶即可享受 30% 的折扣。\\n如果影片是在星期四租地,那麼客戶即可以享受 50% 的折扣。\\n\\n你需要撰寫程式碼去滿足這個需求。\\n\\n你要如何完成這段程式碼?回答時,在回答區選擇適當的程式碼片段。\\n\\n注意:每個正確的選項都可獲得一分。\\n`\\nq.options = `\\n!= \\\"n\\\":\\n== \\\"n\\\":\\n== \\\"y\\\":\\n${OPTION_SPLITER}\\n== \\\"Sunday\\\":\\n\u003e= \\\"Sunday\\\":\\nis \\\"Sunday\\\":\\n${OPTION_SPLITER}\\n== \\\"Thursday\\\":\\n\u003c= \\\"Thursday\\\":\\nis \\\"Thursday\\\":\\n`\\nq.content = `\\n# Southridge Video, DVD 出租計算器\\nontime = input(\\\"影片是在晚上8點前返還的嗎? y 或 n\\\").lower()\\n\\ndays_rented = int(input(\\\"影片出租了幾天?\\\"))\\n\\nday_rented = input(\\\"影片是在星期幾出租?\\\").capitalize()\\n\\ncost_per_day = 1.59\\n\\nif ontime ${CONTENT_SELECTER}\\n days_rented += 1\\nif day_rented ${CONTENT_SELECTER}\\n total = (days_rented * cost_per_day)*0.7\\n\\nelif day_rented ${CONTENT_SELECTER}\\n total = (day_rented * cost_per_day)*0.5\\n\\nelse:\\n\\n total = days_ranted *cost_per_day\\n\\nprint(\\\"DVD的租借費用為:$\\\", total)`\\nq.answer = {0: 1, 1: 0, 2: 0}\\nDATA.push(q)\\n\\n// 24\\nq = {}\\nq.type = SELECT\\nq.description = `\\nLucerne Publishing 公司需要一種方法來查詢出版物中特定字母的數量,以確保有一個良好的平衡。似乎有出現關於過度使用字母 e 的抱怨。你需要創建一個函數以滿足要求。\\n\\n你要如何完成這段程式碼?回答時,在回答區選擇適當的程式碼片段。\\n\\n注意:每個正確的選擇都可獲得一分。\\n`\\nq.options = `\\nword_list in word:\\nword in word_list:\\nword == word_list:\\nword is word_list\\n${OPTION_SPLITER}\\nword is letter:\\nletter is word:\\nword in letter:\\nletter in word:\\n`\\nq.content = `\\n\\n#函數接受檔案中的文字清單,\\n# 以及要搜索的字母,\\n#返回該清單中特定字母的數量。\\n\\ndef count_letter(letter,word_list):\\n count = 0\\n for ${CONTENT_SELECTER}\\n if ${CONTENT_SELECTER}\\n count += 1\\n return count\\n\\nword_list = []\\n#word_list 是由檔案中取得.程式碼中並未顯示.\\n\\nletter = input(\\\"你想要計算哪個字母的數量\\\")\\nletter_count = count_letter(letter , word_list)\\nprint(\\\"一共有:\\\",letter_count,\\\"個字母\\\"+letter)\\n`\\nq.answer = {0: 1, 1: 3}\\nDATA.push(q)\\n\\n// 25\\nq = {}\\nq.type = SELECT\\nq.description = `\\n你創建以下程式來找出會議室並顯示房間名稱。其中包含的行號只是做為參考。\\n\\n01 rooms = {1 : 'Foyer',2 : 'Conference Room'}\\n02 room = input(\\\"輸入房間號碼:\\\")\\n03 if not room in rooms:\\n04 print('該房間並不存在.')\\n05 else:\\n06 print(\\\"房間名稱為\\\" + rooms[room])\\n\\n同事們回報說程式有時會產生不正確的結果。\\n\\n你需要對程式進行故障排除。根據程式碼片段中提供的資訊,使用下拉選單選擇每個問題的答案選項。\\n`\\nq.options = `\\nbool 與 string\\nfloat 與 bool\\nint 與 string\\nfloat 與 int\\n${OPTION_SPLITER}\\nbool\\nfloat\\nint\\nstring\\n${OPTION_SPLITER}\\n語法不正確\\n資料類型不匹配\\n變數命名錯誤\\n`\\nq.content = `\\n在 01 行中有哪兩種資料類型儲存在 rooms 清單中? ${CONTENT_SELECTER}\\n\\n在 02 行中room的資料類型是什麼? ${CONTENT_SELECTER}\\n在 03 行中為什麼會在rooms清單中找不到資料? ${CONTENT_SELECTER}\\n`\\nq.answer = {0: 2, 1: 3, 2: 1}\\nDATA.push(q)\\n\\n// 26\\nq = {}\\nq.type = SELECT\\nq.description = `\\n你為你的公司開發一個Python應用程式。\\n\\n你有以下的程式碼。其中包含的行號只是做為參考。\\n\\n01 def test(a,b,c,d):\\n02 value = a + b * c - d\\n03 return value\\n\\n根據程式碼片段中提供的資訊使用下拉式選單選擇每個問題的答案選項\\n`\\nq.options = `\\na + b\\nb * c\\nc - d\\n${OPTION_SPLITER}\\n加( + )\\n減( - )\\n${OPTION_SPLITER}\\n(a + b) * (c - d)\\n(a + (b * c)) - d\\na + ((b * c) - d)\\n`\\nq.content = `\\n運算式的哪個部分將第一個進行計算? ${CONTENT_SELECTER}\\n運算式的哪個部分將第二個進行計算? ${CONTENT_SELECTER}\\n哪個運算式等於題目函數中的運算式? ${CONTENT_SELECTER}\\n`\\nq.answer = {0: 1, 1: 0, 2: 1}\\nDATA.push(q)\\n\\n// 27\\nq = {}\\nq.type = OPTIONS\\nq.description = `\\n你為公司開發 Python 應用程式。\\n\\n一個名為 employees 的串列包含200個員工姓名,最後五名為公司管理階層。你需要去分割串列去顯示除了管理階層之外的所有員工。\\n\\n你應該使用哪兩個程式碼片段?每個正確的答案都提供了一個完整的解決方案。請選擇兩個。\\n`\\nq.options = `\\nemployees[:-5]\\n${OPTION_SPLITER}\\nemployees[0:-4]\\n${OPTION_SPLITER}\\nemployees[0:-5]\\n${OPTION_SPLITER}\\nemployees[1:-5]\\n${OPTION_SPLITER}\\nemployees[1:-4]\\n`\\nq.content = ``\\nq.answer = [0, 2]\\nDATA.push(q)\\n\\n// 28\\nq = {}\\nq.type = DROG_AND_DROP\\nq.description = `\\n將資料類型與類型運算結果對應。\\n\\n回答時,請將適合的資料類型拖動到正確的類型運算結果中。每種資料類型可以使用一次,多次,或不使用。\\n`\\nq.options = `\\nint\\n${OPTION_SPLITER}\\nfloat\\n${OPTION_SPLITER}\\nstr\\n${OPTION_SPLITER}\\nbool\\n`\\nq.content = `\\ntype(+1E10) ${CONTENT_SELECTER}\\ntype(5.0) ${CONTENT_SELECTER}\\ntype(\\\"True\\\") ${CONTENT_SELECTER}\\ntype(False) ${CONTENT_SELECTER}\\n`\\nq.answer = {0: 1, 1: 1, 2: 2, 3: 3}\\nDATA.push(q)\\n\\n// 29\\nq = {}\\nq.type = OPTIONS\\nq.description = `\\nNorthwind Traders 公司已聘請你成為在程式開發團隊中創建電子商務應用程式的實習生。\\n\\n你必須編寫一個腳本來要求使用者提供一個值。即使使用者輸入了小數,該值也必須轉換為整數來進行計算。\\n\\n你需要編寫程式碼以滿足要求。\\n\\n你應該使用哪個程式碼片段?\\n`\\nq.options = `\\ntotalItems = str(input(\\\"你想要多少項目?\\\"))\\n${OPTION_SPLITER}\\ntotalItems = input(\\\"你想要多少項目?\\\")\\n${OPTION_SPLITER}\\ntotalItems = int(input(\\\"你想要多少項目?\\\"))\\n${OPTION_SPLITER}\\ntotalItems = float(input(\\\"你想要多少項目?\\\"))\\n`\\nq.content = ``\\nq.answer = [2]\\nDATA.push(q)\\n\\n// 30\\nq = {}\\nq.type = DROG_AND_DROP\\nq.description = `\\n你正在編寫一個Python程式。該程式收集客戶資料並將其儲存在資料庫中。\\n\\n這個程式處理各式各樣的資料。\\n\\n你需要確保程式能夠正確地處理資料,以便能夠正確地儲存在資料庫中。\\n\\n將資料類型與程式碼片段對應。回答時,請將適當的資料類型從左側的列拖動到右側的程式碼片段。每種資料類型可以使用一次,多次或不使用。\\n`\\nq.options = `\\nbool\\n${OPTION_SPLITER}\\nfloat\\n${OPTION_SPLITER}\\nint\\n${OPTION_SPLITER}\\nstr\\n`\\nq.content = `\\n\\nage = 2 ${CONTENT_SELECTER}\\nminor = False ${CONTENT_SELECTER}\\nname = \\\"Contoso\\\" ${CONTENT_SELECTER}\\nweight = 123.5 ${CONTENT_SELECTER}\\nzip = \\\"81000\\\" ${CONTENT_SELECTER}\\n`\\nq.answer = { 0: 2, 1: 0, 2: 3, 3: 1, 4: 3 }\\nDATA.push(q)\\n\\n// 31\\nq = {}\\nq.type = DROG_AND_DROP\\nq.description = `\\n你編寫了一個Python程式去執行數學運算。\\n\\n你創建了以下的程式碼:\\n\\na = 11\\nb = 4\\n\\n何者是下列每個數學運算式的結果?回答時,請將適當的運算式從左側的列拖動到右側的結果。每個運算式都可以使用一次,多次或不使用。\\n`\\nq.options = `\\nprint(a / b)\\n${OPTION_SPLITER}\\nprint(a // b)\\n${OPTION_SPLITER}\\nprint(a % b)\\n`\\nq.content = `\\n2 ${CONTENT_SELECTER}\\n3 ${CONTENT_SELECTER}\\n2.75 ${CONTENT_SELECTER}\\n`\\nq.answer = { 0: 1, 1: 2, 2: 0 }\\nDATA.push(q)\\n\\n// 32\\nq = {}\\nq.type = SELECT\\nq.description = `\\n你是Northwind Electric Cars 的實習生。你必須製作一個函數為他們的車輛計算在400公尺跑道上的平均速度。輸出結果必須盡可能精準。\\n\\n要如何完成程式碼?回答時,請在回答區選擇適當的程式碼片段。\\n`\\nq.options = `\\nint\\nstr\\nfloat\\n${OPTION_SPLITER}\\nint\\nstr\\nfloat\\n`\\nq.content = `\\n#速度計算器\\n\\ndistance = ${CONTENT_SELECTER} (input(\\\"請輸入以公尺為單位的行駛距離\\\"))\\n\\ndistance_kms = distance / 1000 #轉換為公里\\n\\ntime = ${CONTENT_SELECTER}(input(\\\"請輸入以秒為單位的經過時間\\\"))\\ntime_hours = time / 3600 #轉換為小時\\n\\nvelocity = distance_kms / time_hours\\nprint(\\\"平均時速是:\\\",velocity,\\\"公里/小時\\\")\\n`\\nq.answer = {0: 2, 1: 2}\\nDATA.push(q)\\n\\n// 33\\nq = {}\\nq.type = TRUE_OR_FALSE\\nq.description = `\\n在學校放假期間,你自願向你的學弟妹們解釋一些基本的程式設計概念。\\n\\n你伊旺在Python中介紹資料類型的概念。你創建以下三個程式碼片段:\\n\\n#程式碼片段1\\nx1 = \\\"20\\\"\\ny1 = 3\\na = x1 * y1\\n\\n#程式碼片段2\\nx2 = 6\\ny2 = 4\\nb = x2 / y2\\n\\n#程式碼片段3\\nx3 = 2.5\\ny3 = 1\\nc = x3 / y3\\n\\n你需要對這些程式碼片段評估。\\n\\n針對下列每個敘述,如果是正確的就選擇Yes,否則請選擇No。\\n\\n注意:每個正確的選擇都可獲得一分\\n`\\nq.options = `\\n執行程式碼片段 1 後,變數a的資料類型為str。\\n${OPTION_SPLITER}\\n執行程式碼片段 2 後,變數b的資料類型為float。\\n${OPTION_SPLITER}\\n執行程式碼片段 3 後,變數c的資料類型為int。\\n`\\nq.content = ``\\nq.answer = {0: 'yes', 1: 'yes', 2: 'no'}\\nDATA.push(q)\\n\\n// 34\\nq = {}\\nq.type = DROG_AND_DROP\\nq.description = `\\nTailspin Toys 將現有的應用程式轉換為Python。你正在創建幾位正在園隊中工作的實習生將會使用的文檔。\\n\\n你需要確保算術運算式的程式碼是正確的。\\n\\n按先後順序從頭至尾排列這六類運算的正確順序是什麼?回答時,請將運算清單中的所有運算移動到回答區,並按正確的順序排列它們。\\n`\\nq.options = `\\n正數( + )、負數( - )與反位元( not )\\n${OPTION_SPLITER}\\n括弧\\n${OPTION_SPLITER}\\n乘法和除法( * , / )\\n${OPTION_SPLITER}\\n加法和減法( + , - )\\n${OPTION_SPLITER}\\n指數( ** )\\n${OPTION_SPLITER}\\n且( and )\\n`\\nq.content = `\\n${CONTENT_SELECTER}\\n${CONTENT_SELECTER}\\n${CONTENT_SELECTER}\\n${CONTENT_SELECTER}\\n${CONTENT_SELECTER}\\n${CONTENT_SELECTER}\\n`\\nq.answer = {0: 1, 1: 4, 2: 0, 3: 2, 4: 3, 5: 5}\\nDATA.push(q)\\n\\n// 35\\nq = {}\\nq.type = OPTIONS\\nq.description = `\\n計算以下的Python數學運算式:\\n\\n(3 * ( 1 + 2 ) ** 2 - ( 2 ** 2) * 3 )\\n\\n結果為何?\\n\\n`\\nq.options = `\\n3\\n${OPTION_SPLITER}\\n13\\n${OPTION_SPLITER}\\n15\\n${OPTION_SPLITER}\\n69\\n`\\nq.content = ``\\nq.answer = [2]\\nDATA.push(q)\\n\\n// 36\\nq = {}\\nq.type = DROG_AND_DROP\\nq.description = `\\n你正在編寫Python程式用於計算一個數學公式\\n\\n公式內容為 b 等於 a 乘以 -1,然後再平方,其中 a 是輸入的值,b 是結果。\\n\\n你創建下面的程式碼片段。其中包含的行號只是做為參考。\\n\\n01 a = eval(input(\\\"請輸入一個數字:\\\"))\\n02 b =\\n\\n你需要確保結果是正確的。\\n\\n如何完成 02 行的程式碼?回答時,請將適合的程式碼片段拖動到正確的位置。美個程式碼片段都可以使用一次,多次或不使用。你可能需要在窗格之間拖動分欄的寬度或捲動位置來查看內容。\\n\\n注意:每個正確的選擇都可獲得一分。\\n`\\nq.options = `\\n-\\n${OPTION_SPLITER}\\n(\\n${OPTION_SPLITER}\\n)\\n${OPTION_SPLITER}\\n**\\n${OPTION_SPLITER}\\n**2\\n${OPTION_SPLITER}\\n2\\n${OPTION_SPLITER}\\na\\n`\\nq.content = `\\nb = ${CONTENT_SELECTER}${CONTENT_SELECTER}${CONTENT_SELECTER}${CONTENT_SELECTER}${CONTENT_SELECTER}\\n`\\nq.answer = { 0: 1, 1: 0, 2: 6, 3: 2, 4: 4 }\\nDATA.push(q)\\n\\n// 37\\nq = {}\\nq.type = OPTIONS\\nq.description = `\\n你正在創建一個Python程式,在服務周年紀念日向員工顯示祝賀資訊。\\n\\n你需要計算服務年資和列印祝賀消息。\\n\\n你已經編寫了以下程式碼。其中包含的行號只是做為參考。\\n\\n01 start = input(\\\"你在公司開始工作是幾歲?\\\")\\n02 end = input(\\\"你今天幾歲?\\\")\\n03 \\n\\n你需要完成這個程式。\\n\\n你應該在 03 行使用哪個程式碼?\\n`\\nq.options = `\\nprint(\\\"恭賀你已經服務了\\\" + int(end - start) + \\\"年!\\\")\\n${OPTION_SPLITER}\\nprint(\\\"恭賀你已經服務了\\\" + str(end - start) + \\\"年!\\\")\\n${OPTION_SPLITER}\\nprint(\\\"恭賀你已經服務了\\\" + (int(end)-int(start))+\\\"年!\\\")\\n${OPTION_SPLITER}\\nprint(\\\"恭賀你已經服務了\\\" + str(int(end)-int(start))+\\\"年!\\\")\\n`\\nq.content = ``\\nq.answer = [3]\\nDATA.push(q)\\n\\n// 38\\nq = {}\\nq.type = OPTIONS\\nq.description = `\\n你正在編寫的程式碼用來生成的隨機整數,最小值為5,最大值為11。\\n\\n你應該使用哪兩種函數?每個正確的答案都提供了一個完整的解決方案。選擇兩個。\\n`\\nq.options = `\\nrandom.randint(5 , 12)\\n${OPTION_SPLITER}\\nrandom.randrange(5 , 12 , 1)\\n${OPTION_SPLITER}\\nrandom.randint(5 , 11)\\n${OPTION_SPLITER}\\nrandom.randrange(5 , 11 , 1)\\n`\\nq.content = ``\\nq.answer = [1, 2]\\nDATA.push(q)\\n\\n// 39\\nq = {}\\nq.type = OPTIONS\\nq.description = `\\n你正在編寫使用 sqrt 函數的應用程式。這個程式必須使用名稱 squareRoot 引用該函數。\\n\\n你需要導入該函數。\\n\\n你應該使用哪個程式碼片段?\\n\\n`\\nq.options = `\\nimport math.sqrt as squareRoot\\n${OPTION_SPLITER}\\nimport sqrt from math as squareRoot\\n${OPTION_SPLITER}\\nfrom math.sqrt as squareRoot\\n${OPTION_SPLITER}\\nfrom math import sqrt as squareRoot\\n`\\nq.content = ``\\nq.answer = [3]\\nDATA.push(q)\\n\\n// 40\\nq = {}\\nq.type = OPTIONS\\nq.description = `\\n你正在創建一個處理數字的函數。該函數具有以下要求:\\n\\n將浮點數傳遞到函數中\\n函數必須取浮點數的絕對值\\n整數後的任何小數必須去除\\n\\n你應該使用哪兩個 Math 函數?每個正確的答案都是解決方案的一部分。選擇兩個。\\n`\\nq.options = `\\nmath.ceil(x)\\n${OPTION_SPLITER}\\nmath.floor(x)\\n${OPTION_SPLITER}\\nmath.fabs(x)\\n${OPTION_SPLITER}\\nmath.fmod(x)\\n${OPTION_SPLITER}\\nmath.frexp(x)\\n`\\nq.content = ``\\nq.answer = [0, 2]\\nDATA.push(q)\\n\\n\\n\\n\\n\\n\\n\\n\\nfunction isNotEmptyString (str) {\\n return str != '';\\n}\\nDATA.forEach(exam =\u003e {\\n\\n if (exam.type === OPTIONS) {\\n exam.options = exam.options.split(OPTION_SPLITER).filter(isNotEmptyString).map(s=\u003es.trim())\\n }\\n\\n if (exam.type === TRUE_OR_FALSE) {\\n exam.options = exam.options.split(OPTION_SPLITER).filter(isNotEmptyString).map(s=\u003es.trim())\\n }\\n\\n if (exam.type === SELECT) {\\n\\n const options = exam.options.split(OPTION_SPLITER).map((options, index) =\u003e {\\n const arr = options.split('\\\\n').filter(isNotEmptyString).map(s=\u003es.trim())\\n arr.answer = exam.answer[index]\\n return arr\\n })\\n\\n const lines = exam.content.split(CONTENT_SELECTER)\\n const mergeLines = []\\n for (let i = 0; i \u003c lines.length; i++) {\\n mergeLines.push(lines[i])\\n if (options[i]) {\\n options[i].idx = i\\n mergeLines.push(options[i])\\n }\\n }\\n\\n exam.content = mergeLines\\n }\\n\\n if (exam.type === DROG_AND_DROP) {\\n exam.options = exam.options.split(OPTION_SPLITER).filter(a =\u003e a != '').map(s=\u003es.trim())\\n\\n const lines = exam.content.split(CONTENT_SELECTER)\\n const mergeLines = []\\n for (let i = 0; i \u003c lines.length; i++) {\\n mergeLines.push(lines[i])\\n \\n if (i \u003c lines.length - 1) {\\n let options = JSON.parse(JSON.stringify(exam.options))\\n options.idx = i;\\n mergeLines.push(options)\\n }\\n }\\n\\n exam.content = mergeLines\\n\\n }\\n\\n exam.description = exam.description.trim()\\n});\\n\\nnew Vue({\\n el: '#app',\\n data: {\\n ...TYPES,\\n AZ: A_TO_Z,\\n exam: DATA,\\n index: 0,\\n userAnswer: [],\\n },\\n\\n mounted() {\\n let hash = location.hash || '#1'\\n this.index = Number(hash.slice(1)) - 1\\n location.hash = hash\\n\\n this.exam.forEach((exam) =\u003e {\\n this.userAnswer.push(exam.answer || {})\\n })\\n },\\n\\n updated() {\\n location.hash = '#' + (this.index + 1)\\n },\\n\\n methods: {\\n toggleFullscreen() {\\n if ((window.fullScreen) || (window.innerWidth == screen.width \u0026\u0026 window.innerHeight == screen.height)) {\\n if (document.exitFullscreen) {\\n document.exitFullscreen();\\n } else if (document.mozCancelFullScreen) { /* Firefox */\\n document.mozCancelFullScreen();\\n } else if (document.webkitExitFullscreen) { /* Chrome, Safari and Opera */\\n document.webkitExitFullscreen();\\n } else if (document.msExitFullscreen) { /* IE/Edge */\\n document.msExitFullscreen();\\n }\\n \\n } else {\\n let el = document.getElementById(\\\"app\\\")\\n if (el.requestFullscreen) {\\n el.requestFullscreen();\\n } else if (el.mozRequestFullScreen) {\\n el.mozRequestFullScreen();\\n } else if (el.webkitRequestFullscreen) {\\n el.webkitRequestFullscreen();\\n } else if (el.msRequestFullscreen) {\\n el.msRequestFullscreen();\\n }\\n }\\n\\n },\\n prev() {\\n if (this.index \u003e 0) this.index--\\n },\\n next() {\\n if (this.index \u003c this.exam.length - 1) this.index++\\n },\\n },\\n\\n computed: {\\n current() {\\n return this.exam[this.index] || {}\\n },\\n currentAnswer() {\\n return this.userAnswer[this.index] || []\\n },\\n isFirst() {\\n return this.index === 0\\n },\\n isLast() {\\n return this.index === this.exam.length - 1\\n }\\n }\\n})\\n\"}","created_at":"2020-08-26T18:44:15.536+08:00","updated_at":"2020-09-03T13:53:28.761+08:00","name":"MTA python 考前猜題(第一份)","language":"web","screenshot":{"url":"/uploads/project/screenshot/185740/d8991291f464a27928ce9aa60ea43fc5.jpg"},"parent_id":3,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":431,"hashid":"rdvse6v2","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3154755,"file_name":"koding.png","project_id":185740,"asset_id":182920,"created_at":"2020-08-26T18:44:15.542+08:00","updated_at":"2020-08-26T18:44:15.542+08:00"}]
Orange Apple Learning Platform
My Projects
View Project Page
Export
Remix
Import
Delete
Download Android APP (APK)
Screenshot
Open Web Site
繁中
简中
English
日本語
1:1:1
1:1
Full Width
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer