怪異的萬聖節:圖示素材,給對生活有儀式感的設計師!
阿新 • • 發佈:2020-10-12
這個作業屬於哪個課程 | https://edu.cnblogs.com/campus/gdgy/Networkengineering1834 |
---|---|
這個作業要求在哪裡 | https://edu.cnblogs.com/campus/gdgy/Networkengineering1834/homework/11148 |
這個作業的目標 | 實現自動生成小學四則運算題目程式,熟悉使用PSP表格估計、單元測試 |
- 專案成員:
陳偉建 3118005269
何曉鋒 3118005273 - 語言:Python
- 版本:3.8.3
- IDE: PyCharm
一.GitHub地址
二.實現過程
(1).流程圖:
(2).程式碼邏輯
#程式碼基礎塊1 def factor_Chan_He(): # 隨機生成 自然數、真分數 global max while (True): index = random.randint(1, 2) # 隨機生成1或者2 1就生成自然數因子,2就生成真分數因子 if (index == 1): # 自然數,先設定為1到10 int_cwj = random.randint(1, max) int_cwj_0 = fractions.Fraction(int_cwj) return int_cwj_0 break if (index == 2): fenzi = random.randint(1, max) fenmu = random.randint(1, max) true_fraction = fractions.Fraction(fenzi, fenmu) if (true_fraction < 1): return true_fraction break
#程式碼基礎塊2 def operation_Chan_He(a, b, operation_symbol): #生成兩位數的運算基礎塊,以後在此基礎上生成多位數的運算 P = "NOT" if (operation_symbol == "+"): result = a + b return result if (operation_symbol == "-"): if (a >= b): result = a - b return result else: return P if (operation_symbol == "*"): result = a * b return result if (operation_symbol == "/"): result = a / b return result
#程式碼基礎塊
def product():
#呼叫operation_Chan_He,factor_Chan_He函式生成兩位數的式子
two_index = []
a = factor_Chan_He()
b = factor_Chan_He()
while (True):
operation_symbol = random.choice('+-*/')
# print(a, b, operation_symbol)
result = operation_Chan_He(a, b, operation_symbol)
# print(result)
if(result != "NOT"):
# print("可以")
two_index.extend((a,b,operation_symbol))
break
return result,two_index
三.效能分析
Name顯示被呼叫的模組或者函式;Call Count顯示被呼叫的次數;Time(ms)顯示執行時間和時間百分比,時間單位為毫秒(ms)
Call Graph(呼叫關係圖):
四.程式碼覆蓋率
五.PSP表格
PSP2.1 | Personal Software Process Stages | 預估耗時(分鐘) | 實際耗時(分鐘) |
---|---|---|---|
Planning | 計劃 | 50 | 50 |
· Estimate | · 估計這個任務需要多少時間 | 50 | 50 |
Development | 開發 | 1330 | 1350 |
· Analysis | · 需求分析 (包括學習新技術) | 120 | 100 |
· Design Spec | · 生成設計文件 | 60 | 40 |
· Design Review | · 設計複審 | 60 | 60 |
· Coding Standard | · 程式碼規範 (為目前的開發制定合適的規範) | 20 | 30 |
· Design | · 具體設計 | 60 | 50 |
· Coding | · 具體編碼 | 960 | 1020 |
· Code Review | · 程式碼複審 | 30 | 30 |
· Test | · 測試(自我測試,修改程式碼,提交修改) | 20 | 20 |
Reporting | 報告 | 130 | 120 |
· Test Repor | · 測試報告 | 90 | 80 |
· Size Measurement | · 計算工作量 | 10 | 10 |
· Postmortem & Process Improvement Plan | · 事後總結, 並提出過程改進計劃 | 30 | 30 |
六.結果預覽
Exercises.txt檔案:
Answers.txt檔案:
專案小結
通過這次結對專案收穫了很多東西,在提高程式碼能力的同時也學會了和別人配合來提高工作效率。在寫論文查重演算法的時候,程式耗費時間過長,在經過思考後,決定加了一個列表,用0和1標記題目,0代表該題目沒有經過檢查,1就代表檢查過了,這樣在查重過程中避免了重複查詢,大大地提高了程式執行速度。
陳偉建:何曉鋒思維構思很好,為專案提供了很多思路。
何曉鋒:陳偉建程式碼能力較好,通過溝通解決了很多問題。