Introduction to AI
Senior 1 · ICT
Introduction to AI
Lesson 3 of 5
25 min
A good way to understand AI is to compare it with something simpler. In this lesson you will look inside a tiny chatbot that follows rules, compare it with a modern AI chatbot, and then tour the ways AI is used in health, farming, money, transport and more, including in Rwanda.
A chatbot is a program you can have a conversation with by typing or speaking. The first chatbots, such as ELIZA in 1966, worked by looking for keywords and giving a reply that a programmer had written in advance. Here is one written in Python. You do not need to know Python to follow it; read the comments after each #.
When you run it, the program prints:
Muraho! How can I help you?The library opens at 7:30 and closes at 17:00.Sorry, I do not understand. Please ask a teacher.
The bot changes the message to lower case, then checks each keyword in order and gives the reply stored for the first keyword it finds. The football question contains no keyword, so it gets the default reply. The bot knows only what the programmer wrote. It never learns, and a spelling mistake such as "libary" defeats it.
Modern AI chatbots are built very differently. They are trained on enormous amounts of text and learn the patterns of language, so they can generate new sentences on almost any topic. An example conversation:
Student: Explain what a computer network is to an S1 student in two sentences.
AI chatbot: A computer network is a group of computers and other devices linked together so that they can share information and resources, such as a printer or an internet connection. Your school lab, where every computer can print on the same printer, is a small network.
| Rule-based chatbot | AI chatbot | |
|---|---|---|
| Where its replies come from | Replies written in advance by a programmer | New text generated from patterns learned from huge amounts of data |
| Questions it can handle | Only those that contain its keywords | Almost any question, in many languages |
| Spelling mistakes | Often defeat it | Usually understood |
| Can it be wrong? | Only if the programmer's reply is wrong | Yes: it can state false "facts" confidently |
When an AI chatbot confidently gives an answer that is false or invented, this is called a hallucination. It happens because the chatbot produces text that sounds likely, not text that it has checked. Always check important facts in a trusted source.
| Sector | What AI does | Example |
|---|---|---|
| Health | Reads X-rays and scans; plans routes for delivery drones | Since 2016, Zipline drones have flown blood and medicines to hospitals across Rwanda |
| Agriculture | Spots crop diseases from photos; forecasts weather | A farmer photographs a cassava leaf to check it for disease |
| Finance | Spots payments that look like fraud | A mobile-money provider blocks a transfer that is very unusual for that customer |
| Education | Adapts practice to each learner; answers questions | A learning app gives more practice on the topics you get wrong |
| Transport | Finds fast routes; drives vehicles | Self-driving taxis carry passengers in some cities in the USA and China |
| Communication | Translation, speech-to-text, spam filtering | Translating an English website into Kinyarwanda |
| Security | Recognises faces and number plates | Cameras that read the number plates of cars breaking the speed limit |


| Positive impacts | Negative impacts and risks |
|---|---|
| Faster, cheaper services (for example, blood arrives in minutes instead of hours) | Some jobs change or disappear, so workers need new skills |
| Better decisions from data in health and farming | Unfair results if the AI learned from biased data (Lesson 4) |
| New jobs: AI engineers, data specialists, trainers of AI systems | Loss of privacy when AI collects personal data |
| Help for people with disabilities | False information and fake photos or videos (deepfakes) |
| Learning support at any time of day | Over-dependence: students who let AI think for them learn less |
Tip
Rule-based bots only look up answers a person wrote; AI chatbots generate answers from learned patterns and can hallucinate. In exam questions on applications, name the sector, what the AI does, and a concrete example.
Using the chatbot program above, what reply does the message hello, is ICT on the timetable? get, and why?
Solution: Muraho! How can I help you? The bot checks the keywords in order, and hello comes before timetable. It stops at the first match, so the question about the timetable is never answered. This shows how rigid rule-based bots are.
Add a rule so that the bot answers questions containing the word uniform.
Solution: Add a line to rules, for example "uniform": "The school uniform is a blue shirt and black trousers or skirt.",. The bot can only answer what a programmer has written.
An AI chatbot tells Uwase that Lake Kivu is the largest lake in Africa. What has happened, and what should she do?
Solution: The chatbot has hallucinated: Lake Victoria is Africa's largest lake. Uwase should check facts in a trusted source such as an atlas or textbook before using them.
Give one application of AI in agriculture and one in finance.
Solution: Agriculture: an app that identifies crop disease from a leaf photo, or AI weather forecasts. Finance: detecting unusual payments that may be fraud.
Give one positive and one negative impact of AI on jobs.
Solution: Positive: new jobs such as AI engineer and data specialist. Negative: some routine jobs, such as simple data entry, may be done by machines, so workers need to learn new skills.
Summary
Sources and credits
The Python chatbot, the example conversation, the comparison and impact tables and the practice items were written by Ganzaa.
This lesson adapts CC BY-SA material and is shared under CC BY-SA 4.0.
# A tiny rule-based chatbot, like the very first chatbots
rules = {
"hello": "Muraho! How can I help you?",
"timetable": "ICT is on Monday and Thursday.",
"library": "The library opens at 7:30 and closes at 17:00.",
}
def reply(message):
message = message.lower() # so LIBRARY and library match
for keyword in rules:
if keyword in message:
return rules[keyword]
return "Sorry, I do not understand. Please ask a teacher."
print(reply("Hello there"))
print(reply("When is the library open?"))
print(reply("Who won the football match?"))