Imagine you’ve been tasked with building a new online tool called Doctor Internet.
If someone is feeling unwell, they can answer a few simple questions about symptoms and Doctor Internet will identify their illness and produce a prescription to take to the chemist.
As a class, discuss:
What are the risks posed by this system? What could go wrong?
Note: There are numerous very high risks inherent in this system.
These solutions were much hyped, particularly in the 1980s for business and finance applications. Such solutions were called expert systems. This Wikipedia article explains how the concept went out of favour in the 1990s, but the conditional logic became integrated into other, broader solutions.
Image credit: jennycepeda/pixabay
In this lesson, students will:
words = ['dark', 'ghastly', 'light', 'bones', 'monkey']
no_of_items = len(words)
print('The number of items in the array is', no_of_items)
BEGIN colours ← [‘red’, ‘yellow’, ‘green’, ‘purple’, ‘orange’, ‘blue’] Display “I know this many colours: ”, length of colours Display “The first colour I know is ”, colours Display “The second colour is ”, colours Display “The last colour is ”, colours[length of colours – 1] END
For more on setting up and choosing a language, see Setting Up.
This video demonstrates coding a simple decision maker program, then expands it to a Magic 8 Ball program.
Choose two of the links below (eg. Scratch and Python) to find the simple decision maker programs. As in the video, build on those programs so that they now include all of the standard 20 Magic 8 Ball responses.
Edit the program to make your Magic 8 Ball optimistic or pessimistic. After asking the first question, the program should ask the user if they want an optimistic or pessimistic response (o or p).
If the user chooses ‘o’, the program chooses randomly from among the first 10 responses. If the user chooses ‘p’, the program chooses randomly from among the last five responses.
These challenges use the skills covered so far. By writing or modifying their own programs, students have an opportunity to demonstrate Application and Creation.
Create a program to help a teacher pick a random student in the class. The program will choose and display a student name from an array of 20 or more names.
Back in Lesson 3: Challenge 1, we used if-else code to make a decision based on our random number, but that was useful only for a small number of names. Now, you can start with an array that includes all the names, so there’s no need for if-else code.
Remember, your program must still work perfectly if the array is different, for example, if you add or remove an extra student name.
Create a program to tell you the country where you can find a famous landmark.
The program should contain two arrays, one with landmarks and another with their countries. The order of each array must match. For example:
|3||Sydney Opera House||3||Australia|
Start by displaying the complete array of landmarks. The user then selects one by entering a number. Finally, the correct country is displayed.
An example of how the program should appear:
Here are the landmarks you can choose from... Eiffel Tower, Big Ben, Borobudur, Sydney Opera House Enter number to learn the country (first is 0): 2 Borobudur is in Indonesia.
Challenge early finishers to make the program more user friendly. User can now enter 1 for the first landmark, instead of 0.
(OPTIONAL) Create a program to sort a list of TV shows into alphabetical order.
Start with an array of 10 or more TV show names, not in alphabetical order. Display the array as it is.
capitals = ['Canberra', 'Paris', 'London', 'Kinchasa', 'Rome']
var capitals = ['Canberra', 'Paris', 'London', 'Kinchasa', 'Rome'];
Once sorted, display the array again to see the result.