Your own mini-project: plan, build, test, explain
Your mini-project is your own, small and checkable on paper. Choose one of two shapes. Shape A is a Python program with a list and a function. Shape B is a small page with one click action. Work in four steps. Plan: write the purpose, who uses it, and the parts. Build: write the code in short pieces. Test: write a test table with the input, the result you expect, and the result you really get, then fix one thing at a time. Explain: say what it does, what an AI helper may do and what it may not. A helper may suggest ideas, explain an error or propose a piece of code to read. It may not decide for you, it may not be trusted without a check, and it may not receive personal data. In the sample program the list holds four invented prices in pounds, the function over_limit tells whether a price is above a limit, and the loop counts the prices above 20 (30 and 25, so 2). The test table checks other limits. Use only invented data in your project.
1prices = [12, 30, 8, 25] 2 3def over_limit(p, limit): 4 return p > limit 5 6count = 0 7for p in prices: 8 if over_limit(p, 20): 9 count = count + 1 10print(count) 11print(sum(prices))
2 75
| limit | expected count | reason |
|---|---|---|
| 20 | 2 | 30 and 25 are above 20 |
| 30 | 0 | no price is above 30 |
| 5 | 4 | all four are above 5 |
1<h2 id="tip">Tip of the day</h2> 2<button id="more">More</button> 3<script> 4document.getElementById("more").onclick = () => { 5 document.getElementById("tip").textContent = "Drink water."; 6}; 7</script>
Choose your own project idea (invented data only). Write the plan in three lines, the code on paper, a test table with at least three rows, and two sentences on what an AI helper may and may not do for you.