الأسبوع 10 · الدرس ١ «التنبؤ باستخدام نموذج الذكاء الاصطناعي» (١): البرمجة التقليدية ونموذج الذكاء الاصطناعي والتنبؤ · 3 دروس
1
Traditional programs follow fixed rules
ICT Prep 3 Term 1, Unit 2, Lesson 1: pp. 66–68
GoalExplain that a traditional program follows rules written by a person and gives the same result for the same input.
New words
traditional program · a program that follows rules written by a personrule · an exact instruction such as: if the count is 10 or more, use the lower pricesame input, same output · a traditional program gives the same result each time it gets the same inputcalculator · the best-known traditional program: 5 + 3 is always 8
Explanation
In Unit 1 you wrote programs: you decided every rule and the computer followed it. This is traditional programming, also called rule-based programming. The program does exactly what its rules say, so the same input gives the same result every time. A calculator is the best example: 5 + 3 is always 8. In the canteen function below, a person decided the rule: ten or more sandwiches cost 4 each, fewer cost 5 each. The computer does not know why, and it will never change the rule by itself. If prices change, a person must edit the code. This makes traditional programs predictable and easy to check. It also means they are good only when a person can write the rules.
a person writes the rules→the program follows them→same input, same result
The canteen function has one rule. For 3 sandwiches the price is 3 * 5 = 15. For 12 sandwiches the price is 12 * 4 = 48. Run it again tomorrow and you get 15 and 48 again.
Python
1print(5 + 3)
2print(5 + 3)
3print(5 + 3)
Output
8
8
8
Running the same line three times gives the same answer three times. This is why a rule-based program can be trusted to repeat itself exactly.
Class activity
Write one rule of your own for a canteen, a library or a bus: a number and a limit, like 10 or more. Write what the program does for two different counts. Does anything change if you run it again tomorrow?