hkitalk.net 香港交通資訊網

 找回密碼
 會員申請加入


(B0)香港巴士車務及車廂設備 (B1)香港巴士廣告消息/廣告車行踪 (B2)香港巴士討論 [熱門] [精華] (B3)巴士攝影作品貼圖區 [熱門] [精華] (B3i)即拍即貼 -手機相&翻拍Mon相 (B4)兩岸三地巴士討論 [精華] (B5)外地巴士討論 [精華]

Advertisement


(B6)旅遊巴士及過境巴士 [精華] (B7)巴士特別所見 (B11)巴士精華區 (B22)巴士迷吹水區   (V)私家車,商用車,政府及特種車輛 [精華]
(A6)相片及短片分享/攝影技術 (A10)香港地方討論 [精華] (A11)消費著數及飲食資訊 (A16)建築物機電裝置及設備 (A19)問路專區 (N)其他討論題目  
(F1)交通路線建議 (C2)航空 [精華] (C3)海上交通及船隻 [精華] (D1)公共交通有關商品 [精華]   (Y)hkitalk.net會員福利部 (Z)站務資源中心
(R1)香港鐵路 [精華] (R2)香港電車 [精華] (R3)港外鐵路 [精華]   (O1)omsi討論區 (O2)omsi下載區 (O3)omsi教學及求助區
(M1)小型巴士綜合討論 (M2)小型巴士多媒體分享區 (M3)香港小型巴士字軌表        
 

Advertisement

 

hkitalk.net 香港交通資訊網»論壇 (B) Bus 巴士討論區 巴士迷吹水區 (B22) 把一道考試題目改成巴士相關(2)
開啟左側

把一道考試題目改成巴士相關(2)

[複製鏈接]
LRT610-1092 發表於 2021-10-23 18:36 來自手機 | 顯示全部樓層 |閱讀模式

                                    Advertisement



以下是科大「COMP1021」課程本學年的期中考試題目改成巴士相關:

A KMB bus captain, scheduled to route 88K, uses a Python program to determine which bus he should drive for the day. The program is as follows:

import random
avbe=["MT593", "MT943", "MW4225", "MX1419"]
atenu=["TX5684", "UH7152", "UU4653", "SV4082"]

bus_choice = []
for i in range (2):
    index=random.randint(0, len(avbe)-1)
    selected_bus=avbe[index]
    bus_choice.append(selected_bus)
    avbe.remove(selected_bus)
    print("Bus", selected_bus, "is chosen.")
    index=random.randint(0, len(atenu)-1)
    selected_bus=atenu[index]
    bus_choice.append(selected_bus)
    atenu.remove(selected_bus)
    print("Bus", selected_bus, "is chosen.")

index=random.randint(0, len(bus_choice)-1)
bus_used=bus_choice[index]

print("Bus", index, "is chosen, so you are going to drive", bus_used, "today".)

If buses 0 for avbe and atenu were drawn first, followed by buses 1 in the revised lists, then bus 2 is drawn from the final list, which bus is the driver using today?

你們有沒有一些可以改成巴士相關的題目?
User12345678910 發表於 2021-10-23 19:15 | 顯示全部樓層
請使用大部分站友的母語
您需要登錄後才可以回帖 登錄 | 會員申請加入

本版積分規則

Advertisement

Advertisement

Advertisement

Advertisement

Advertisement

站規|清理本站Cookies|hkitalk.net 香港交通資訊網

GMT+8, 2024-4-26 04:34

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回復 返回頂部 返回列表