2023-10-03 課程補充資料 Week 04

直線方程式

  1. 標準式 Standard Form: ax + by + c = 0
  2. 點斜式 Point Slope Form: (y - y1) = m(x - x1)
  3. 兩點式 Two Point Form: (y -y1) =[(y2 - y1) / (x2 - x1)] (x - x1)
  4. 斜截式 Slope-intercept Form: y = mx + c
  5. 截距式 Intercept Form: x/a + y/b = 1
  6. Normal Form: x cos θ + y sin θ = p

DEMO 1 task
用 python 計算某一個新聞網頁出現 Taiwan 關鍵字的次數

with open('demo_1003.html') as f:
    lines = f.read()

words = lines.split()
#print(words[0])

search_word = "Taiwan"
count = words.count(search_word)
print("搜尋結果(", search_word, ")", count)

DEMO 2 task
1. 登入
2. 修改暱稱
3. 修改密碼
4. 修改大頭貼
可以使用 Postman, 不過最好是嚐試使用 python 來進行.

今天 API 結果 URL
https://www.cutexyz.com/edu/mlearning2309/API/

如果要看透過學號與中文姓名登入的結果:
https://www.cutexyz.com/edu/mlearning2309/API/index2.php

今日會使用的 API List

API 1: login
Protocol: HTTPS POST
API URL: https://www.cutexyz.com/edu/mlearning2309/API/api_login.php
Parameters:
1. student_uid: 學號
2. pwd: 密碼, 預設為 cute301, 沒有忘記密碼功能, 如果有人忘記, 請先與老師通知
Return Data ( JSON FORMAT ):
1. result: 結果, OK 代表沒問題, ERROR 代表錯誤發生
2. data: 內含唯一資料 token: 用於登入之後呼叫別的 API 搭配使用
3. msg: 如果有特殊裝框需要詳述問題時就會在這邊顯示

如果要看透過學號與中文姓名登入的結果:
https://www.cutexyz.com/edu/gmlearning2309/API/index2.php

API List

API 2: updateprofile
Protocol: HTTPS POST
API URL: https://www.cutexyz.com/edu/mlearning2309/API/api_updateprofile.php
Parameters:
1. student_uid: 學號
2. token: 你在登入後, 由系統發給你的動態密碼, 有效期內這個密碼不會變動
3. mode: 你想使用的功能; 1: 修改暱稱, 2: 修改密碼, 3: 上傳大頭貼
4.value1:帶入的參數, mode 1 請帶入暱稱, mode 2 輕帶入新的密碼, mode 3 請帶入檔案( jpg 限定)
Return Data ( JSON FORMAT ):
1. result: 結果, OK 代表沒問題, ERROR 代表錯誤發生
2. data: null 本 API 不會使用
3. msg: 如果有特殊裝框需要詳述問題時就會在這邊顯示