CP2020-40923218

  • Home
    • Site Map
    • reveal
    • blog
  • 首頁
  • 關於更新
    • 十月份更新
    • 十一月更新
    • 十二月更新
    • 一月份更新
  • 心得
  • 課程內容(HW1)
    • Customer Relations
    • Overview
    • Operational Procedures
      • Customer Service Key Principles
    • Effective Listening
      • Listening skills
    • Taking Ownership
      • Apologizing When Appropriate
      • Show Empathy
    • Remain Courteous and Professional
      • Timeliness
      • Keeping the Customer Informed
    • Problem Resolution and Follow-Up
    • Proper Treatment of a Customer’s Property
    • Putting it All Together
  • 課程內容(HW2)
    • 作業之一(分組數列)
    • 作業之二(是否有加退選)
    • 作業之三()
  • 課程內容(HW3)
    • 19題
    • 25題
      • 猜數字測試
    • 26題
  • 網頁來自Github
    • 運作原理
課程內容(HW2) << Previous Next >> 作業之二(是否有加退選)

作業之一(分組數列)

題目:列出甲班分組數列

import urllib.request
from random import shuffle

target_url = "https://nfulist.herokuapp.com/?semester=1091&courseno=0762"
cp1a = []
for line in urllib.request.urlopen(target_url):
    cp1a.append(line.decode('utf-8').rstrip())

#以上為導出網址中的數列

shuffle(cp1a)
n = 5
m = int(len(cp1a)/n)
list2 = []
for i in range(0, len(cp1a), m):
    list2.append(cp1a[i:i+m])
print(list2)

#以上為數列打亂後重新分組



跑出來的結果

圖上方為數列結果,中間與下方為程式內容。


課程內容(HW2) << Previous Next >> 作業之二(是否有加退選)

Copyright © All rights reserved | This template is made with by Colorlib