8.4 AI Ethics1. Voice Recognition. Hello World. Syntax errors.
2. Chatbots. Artificial Intelligence. Evaluating expressions 3. Comment code. Maths Quiz. 12 x tables quiz. 4. Add score. Pseudocode. Responsive feedback 5 Ethics of AI Starter / ENDER |
RESOURCEs:
|
Task 1:
By the end of the lesson, pupils should be able to:
Part One - Artificial Intelligence
Pupils to share their current impressions of Siri technology and how much this adds to the desirability of devices like iPhones.
Following the video clip(s) pupils to first think of (or list) the advantages and disadvantages of technology like Siri and how it may advance 10 years from now. Pair, share & compare their list with their partner, noting differences on their response
sheet. Then forming groups of 4 or more they should collate their collective responses ready to share these with the rest of the class. To keep to time constraints, each group could report one feature back to the whole class.Play the ‘Eleventh Floor’ clip which highlights one major criticism of speech recognition technology. Students to Consider how Hardware and software are interlinked - case study iPad 1 is now obsolete - is this ethical and sustainable?
Resources:http://tinyurl.com/hcc-python8
Siri iPhone 4s http://youtu.be/5mNcnj2l6RE
Siri Demonstration http://youtu.be/MpjpVAB06O4
Siri talks to Siri http://youtu.be/XBRXA8zmJr8
Using the interactive mode with Python.
Before creating an artificial intelligence simulation, some Python fundamentals. For the next activity, pupils will need to locate and open the Python IDE called 'IDLE' (trivia: named IDLE after Eric Idle). It might be appropriate to show the class what it looks like.
>>> print("Hello World")
Hello World
Computers are machines that are very literal when it comes to following instructions; humans are rarely so literal. Computers are not as good dealing with nearly, almost, and not quite in the way that we humans are. Syntax is used to describe the rules that determine the way that instructions and commands must be written. Python is reputed to be more forgiving of syntax errors than many other programming languages, which can make it easier to learn, meaning more time can be spent creating than debugging. IDLE, the Python IDE has syntax highlighting which automatically assigns colours to different elements, e.g. the “Hello World” phrase should be green. This should help spot some simple errors when typing in commands.To gain a better grasp of syntax errors, ask pupils to first predict what will happen with some of the following and then try them to see what if the response they get matches up with what they predicted.
>>> print"Hello World"
>>> print("Hello World");
>>> Print("Hello World")
>>> print(Hello World)
>>> prin(Hello World)
Some will work and others won’t, ask pupils to also find out and try their own variations. Ask pupils if they can identify a pattern to predict what variations work and which ones do not. Initially, this might seem a fool’s errand – but some groundwork here will reduce debugging problems later on if pupils do not have an understanding of the concept of syntax errors.
Homework: Future Technologies
- Evaluate the effectiveness of Siri on the iPhone and describe
- Create a “Hello World” program in the Python
- Identify and correct common errors in Python programs
- Create, save and test a 'Hello World' program
Part One - Artificial Intelligence
Pupils to share their current impressions of Siri technology and how much this adds to the desirability of devices like iPhones.
Following the video clip(s) pupils to first think of (or list) the advantages and disadvantages of technology like Siri and how it may advance 10 years from now. Pair, share & compare their list with their partner, noting differences on their response
sheet. Then forming groups of 4 or more they should collate their collective responses ready to share these with the rest of the class. To keep to time constraints, each group could report one feature back to the whole class.Play the ‘Eleventh Floor’ clip which highlights one major criticism of speech recognition technology. Students to Consider how Hardware and software are interlinked - case study iPad 1 is now obsolete - is this ethical and sustainable?
Resources:http://tinyurl.com/hcc-python8
Siri iPhone 4s http://youtu.be/5mNcnj2l6RE
Siri Demonstration http://youtu.be/MpjpVAB06O4
Siri talks to Siri http://youtu.be/XBRXA8zmJr8
Using the interactive mode with Python.
Before creating an artificial intelligence simulation, some Python fundamentals. For the next activity, pupils will need to locate and open the Python IDE called 'IDLE' (trivia: named IDLE after Eric Idle). It might be appropriate to show the class what it looks like.
>>> print("Hello World")
Hello World
Computers are machines that are very literal when it comes to following instructions; humans are rarely so literal. Computers are not as good dealing with nearly, almost, and not quite in the way that we humans are. Syntax is used to describe the rules that determine the way that instructions and commands must be written. Python is reputed to be more forgiving of syntax errors than many other programming languages, which can make it easier to learn, meaning more time can be spent creating than debugging. IDLE, the Python IDE has syntax highlighting which automatically assigns colours to different elements, e.g. the “Hello World” phrase should be green. This should help spot some simple errors when typing in commands.To gain a better grasp of syntax errors, ask pupils to first predict what will happen with some of the following and then try them to see what if the response they get matches up with what they predicted.
>>> print"Hello World"
>>> print("Hello World");
>>> Print("Hello World")
>>> print(Hello World)
>>> prin(Hello World)
Some will work and others won’t, ask pupils to also find out and try their own variations. Ask pupils if they can identify a pattern to predict what variations work and which ones do not. Initially, this might seem a fool’s errand – but some groundwork here will reduce debugging problems later on if pupils do not have an understanding of the concept of syntax errors.
Homework: Future Technologies
- Write your own summary of Siri, evaluating its effectiveness
- Discus what future technologies may be on the verge becoming a reality.
- What do you think will be helping humans interface/connect with tech in 10 years time?
Part Two - Making our own AI
By the end of the lesson, pupils should be able to
print("Please type your name in")
my_name = input ()
print("Nice to meet you " + my_name)
Describe an experience of Artificial Intelligence from using chatbots
To develop a better understanding of some current artificial intelligence technologies like Siri, allow
pupils 5 – 10 minutes to allow them opportunities to try some of these themselves. Warn pupils that
some of these chatbots listed in the resources are experimental models. Provide a list of prompts for
pupils to consider. Then invite pupils to share their answers among themselves or with the rest of
the class.
1. What sorts of questions are the chatbots very good at?
2. What questions do chatbots not answer very well?
3. What process/stages are taking place after the user types in a comment?
4. What tricks does the chatbot use to make it seem real, e.g. artificially intelligent?
Resources
A chatbot that talks with sound http://chaturing.com/artwork/ select the ‘chatbot’ menu
A simple text-only chatbot http://chaturing.com/artwork/chatbot/
iGod http://www.titane.ca/concordia/dfar251/igod/main.html
Rosette http://labs.telltalegames.com/rosette/
A directory of chatbots http://www.chatbots.org/language/english/
Another directory of chatbots http://www.pandorabots.com
http://www.existor.com/
Students to consider the kinds of questions and information that people ask about each other when they first
meet, ask pupils to think, pair and share the topics they considered. Some of these may include
where they live, if they have brothers and sisters, what age they are, favourite food etc. At the end
of the activity, each pupil should have a list of question topics.
print("Please type your name in")
my_name = input ()
print("Nice to meet you " + my_name)
print("So, " + my_name + ", what is your favourite food?")
favourite_food = input ()
print("Ah, your favourite food is " + favourite_food)
Next pupils should consider adding more complex questions into their script. Notice in the 4th line
above it is necessary to have two + signs, one either side of the variable my_name. Common errors
to watch for are pupils not having a complete pair of double quotation marks or adding + signs
between variables and strings.
A variable is a stored value, a string (or text string) is a sequence of characters which may be
words. This would be an ideal opportunity to identify to pupils what a string is and what a variable
is – perhaps ask them to search for definitions and develop their own
Homework quiz - quizizz.com/admin/quiz/5a5dcb7b4e482f757cb68df1
By the end of the lesson, pupils should be able to
- Describe an experience of Artificial Intelligence from using chatbots
- Build the first part of an artificial intelligence program using Python
- Use the Python Interpreter as a calculator and explain what an integer is
print("Please type your name in")
my_name = input ()
print("Nice to meet you " + my_name)
Describe an experience of Artificial Intelligence from using chatbots
To develop a better understanding of some current artificial intelligence technologies like Siri, allow
pupils 5 – 10 minutes to allow them opportunities to try some of these themselves. Warn pupils that
some of these chatbots listed in the resources are experimental models. Provide a list of prompts for
pupils to consider. Then invite pupils to share their answers among themselves or with the rest of
the class.
1. What sorts of questions are the chatbots very good at?
2. What questions do chatbots not answer very well?
3. What process/stages are taking place after the user types in a comment?
4. What tricks does the chatbot use to make it seem real, e.g. artificially intelligent?
Resources
A chatbot that talks with sound http://chaturing.com/artwork/ select the ‘chatbot’ menu
A simple text-only chatbot http://chaturing.com/artwork/chatbot/
iGod http://www.titane.ca/concordia/dfar251/igod/main.html
Rosette http://labs.telltalegames.com/rosette/
A directory of chatbots http://www.chatbots.org/language/english/
Another directory of chatbots http://www.pandorabots.com
http://www.existor.com/
Students to consider the kinds of questions and information that people ask about each other when they first
meet, ask pupils to think, pair and share the topics they considered. Some of these may include
where they live, if they have brothers and sisters, what age they are, favourite food etc. At the end
of the activity, each pupil should have a list of question topics.
print("Please type your name in")
my_name = input ()
print("Nice to meet you " + my_name)
print("So, " + my_name + ", what is your favourite food?")
favourite_food = input ()
print("Ah, your favourite food is " + favourite_food)
Next pupils should consider adding more complex questions into their script. Notice in the 4th line
above it is necessary to have two + signs, one either side of the variable my_name. Common errors
to watch for are pupils not having a complete pair of double quotation marks or adding + signs
between variables and strings.
A variable is a stored value, a string (or text string) is a sequence of characters which may be
words. This would be an ideal opportunity to identify to pupils what a string is and what a variable
is – perhaps ask them to search for definitions and develop their own
Homework quiz - quizizz.com/admin/quiz/5a5dcb7b4e482f757cb68df1
PART THREE - MATHS
Using the Python Interpreter as a calculator
Going back now to the imperative mode of the interpreter, we see that Python can function as a
calculator. Ask pupils to solve a series of maths problems using the interpreter, but do not reveal
how to do it straight away.
Activity – Ask pupils to find out how to use Python to work out the answers to these maths
problems. 156 add 567, 132 subtract 46, 256 divided by 8, 389 multiplied by 13. At this early stage,
avoid explaining the keyboard symbols for mathematical operators to see if the class can work
them out for themselves.
The method is shown below, but do not reveal it yet, instead ask the class if they can work it out.
>>> print(2 + 2)
The answers are:
>>> print(156 + 567)
723
>>> print(132 - 46)
86
>>> print(256 / 8)
32.0
>>> print(389 * 13)
5057
Please explain to the class that the mathematical operators in computing are add +, subtract – as
they would expect, but multiply is * and divide is / . This activity goes a long way to explain the
strengths & weaknesses of computers. An effective way to check understanding would be to ask the
class to explain why the following do not work. You might ask them to share this with a partner or
larger group before sharing with the whole class.
>>> what is 2 add 2?
>>> 3 times 6
>>> 24 subtract 3
>>> how many times will 4 fit into 12?
In computing, whole numbers (without decimals) are referred to as integers, this means that while
4.0 is not considered an integer, 4 is. It is possible to store integers into variables.
A short activity to end the lesson could be to assign numbers to variables as in this example below.
>>> pizza = 250
>>> coke = 100
>>> chips = 150
Some interesting expressions can then be evaluated such as:
>>> pizza + chips
400
>>> 2 * pizza
500
The variables could be pupils’ names and ages. Learning this will form the foundation for the next
lesson.
Going back now to the imperative mode of the interpreter, we see that Python can function as a
calculator. Ask pupils to solve a series of maths problems using the interpreter, but do not reveal
how to do it straight away.
Activity – Ask pupils to find out how to use Python to work out the answers to these maths
problems. 156 add 567, 132 subtract 46, 256 divided by 8, 389 multiplied by 13. At this early stage,
avoid explaining the keyboard symbols for mathematical operators to see if the class can work
them out for themselves.
The method is shown below, but do not reveal it yet, instead ask the class if they can work it out.
>>> print(2 + 2)
The answers are:
>>> print(156 + 567)
723
>>> print(132 - 46)
86
>>> print(256 / 8)
32.0
>>> print(389 * 13)
5057
Please explain to the class that the mathematical operators in computing are add +, subtract – as
they would expect, but multiply is * and divide is / . This activity goes a long way to explain the
strengths & weaknesses of computers. An effective way to check understanding would be to ask the
class to explain why the following do not work. You might ask them to share this with a partner or
larger group before sharing with the whole class.
>>> what is 2 add 2?
>>> 3 times 6
>>> 24 subtract 3
>>> how many times will 4 fit into 12?
In computing, whole numbers (without decimals) are referred to as integers, this means that while
4.0 is not considered an integer, 4 is. It is possible to store integers into variables.
A short activity to end the lesson could be to assign numbers to variables as in this example below.
>>> pizza = 250
>>> coke = 100
>>> chips = 150
Some interesting expressions can then be evaluated such as:
>>> pizza + chips
400
>>> 2 * pizza
500
The variables could be pupils’ names and ages. Learning this will form the foundation for the next
lesson.
PART FIVE - MATHS TEST
By the end of the lesson, pupils should be able to
program. They should have managed to add some questions of their own.
print("Please type your name in")
my_name = input ()
print("Nice to meet you " + my_name)
A useful way to go back and check pupils’ understanding of all this would be (with the minimum of
help) to ask all the class to locate and open their questions.py program and add another question,
this time asking the user to name a place they have been on their holidays and then respond with an
answer using the name of the holiday location, e.g. “Hmmm...” + holiday_location + “ sounds a
like a nice place to go”
Comment Your Code
This is now a good time to introduce the practice of commenting code to the class. Comments are
often added to computer programs to allow people to understand the intentions of the person who
created the code. The Python interpreter ignores the comments completely, so syntax is not a
problem. In practise, it is not necessary to comment every line/section – only where it is not obvious
what is going on. However, as the class have probably not experienced commenting before, we will
apply some comments to the simple code we have written so far using the hash key (#). You will
notice that when you use the hash key in the program editor, the text changes to red to indicate the
use of commenting. Comments can be used for sections, or in-line as shown below.
# This program finds out the user's name
print("Please type your name in") #prints message to user
my_name = input () #stores user’s name in a variable
print("Nice to meet you " + my_name) #displays message
Activity – Ask pupils to add comments to all their lines of code. Some questions for pupils to
consider. Try using the think – pair – share approach with these questions.
1. How could you add some information about the program, creator, date etc.?
Answer- add a top line comment with name, date etc.
2. Is it necessary to comment on every single line?
Answer- Only comment when it is not clear to another person
3. If the interpreter ignores everything after the #, how else could this be useful?
Answer- You can use # to ‘comment out’ sections of code that are not working to help with
debugging.
Creating a maths quiz
There is a lot of value in creating games when learning how to program. This part of the lesson
starts with a simple question script that when understood can be used to build a more sophisticated
game. Start by asking pupils to open a new program editor window, we do this in the interpreter by
selecting File – New Window. Then ask them to create the script below, exactly as it appears.
Please pay particular attention to the use of spaces, indents and colons. Some programming
languages, Java for example make extensive use of { } brackets to mark blocks or phrases of code.
Python uses indents instead to mark out separate blocks. So, it is crucial that the indents are used
appropriately.
Ask pupils to save this as maths_question.py – if they all use the same name, it will make it easier
in future lessons to retrieve their work.
print("What is 2 + 2?")
answer = input ()
answer = int(answer)
if answer == 4:
print("Well done")
else:
print("Sorry the answer was 4")
Some will complete this more quickly than others, so ask them to add more questions to their game
while waiting. Once the class have all tested their games, debugged them and run them successfully,
we need to see if the pupils can explain some of the new things in this program.
1. answer = int(answer) - thinking back to use of integers last lesson, what does this do
and what does ‘int’ mean? Answer- this converts a text string into a number or integer. If
we did not convert it to an integer, we could not compare it to another integer, the answer 4.
2. If answer = = 4: - What does the ‘= =’ translate to in plain English Answer- this means
‘equal’ to, as “in is it equal to?”
3. What does the ‘else’ translate to in plain English? Answer-this translates as ‘or else’
4. Why are the indents necessary after the if and else statements? Answer- this means
follow these instructions if the statement above is true
5. What happens if the colons are not there after the 4 or else? You get a Syntax Error
The Ethics of AI:
Open this unit of work from here: 8.4 AI Ethics (Web view)
- Demonstrate and explain the practice of commenting their code
- Create a simple maths test, explain the need to convert a string to an integer
- Make use of ‘if’ statements to create a 12 times table test
program. They should have managed to add some questions of their own.
print("Please type your name in")
my_name = input ()
print("Nice to meet you " + my_name)
A useful way to go back and check pupils’ understanding of all this would be (with the minimum of
help) to ask all the class to locate and open their questions.py program and add another question,
this time asking the user to name a place they have been on their holidays and then respond with an
answer using the name of the holiday location, e.g. “Hmmm...” + holiday_location + “ sounds a
like a nice place to go”
Comment Your Code
This is now a good time to introduce the practice of commenting code to the class. Comments are
often added to computer programs to allow people to understand the intentions of the person who
created the code. The Python interpreter ignores the comments completely, so syntax is not a
problem. In practise, it is not necessary to comment every line/section – only where it is not obvious
what is going on. However, as the class have probably not experienced commenting before, we will
apply some comments to the simple code we have written so far using the hash key (#). You will
notice that when you use the hash key in the program editor, the text changes to red to indicate the
use of commenting. Comments can be used for sections, or in-line as shown below.
# This program finds out the user's name
print("Please type your name in") #prints message to user
my_name = input () #stores user’s name in a variable
print("Nice to meet you " + my_name) #displays message
Activity – Ask pupils to add comments to all their lines of code. Some questions for pupils to
consider. Try using the think – pair – share approach with these questions.
1. How could you add some information about the program, creator, date etc.?
Answer- add a top line comment with name, date etc.
2. Is it necessary to comment on every single line?
Answer- Only comment when it is not clear to another person
3. If the interpreter ignores everything after the #, how else could this be useful?
Answer- You can use # to ‘comment out’ sections of code that are not working to help with
debugging.
Creating a maths quiz
There is a lot of value in creating games when learning how to program. This part of the lesson
starts with a simple question script that when understood can be used to build a more sophisticated
game. Start by asking pupils to open a new program editor window, we do this in the interpreter by
selecting File – New Window. Then ask them to create the script below, exactly as it appears.
Please pay particular attention to the use of spaces, indents and colons. Some programming
languages, Java for example make extensive use of { } brackets to mark blocks or phrases of code.
Python uses indents instead to mark out separate blocks. So, it is crucial that the indents are used
appropriately.
Ask pupils to save this as maths_question.py – if they all use the same name, it will make it easier
in future lessons to retrieve their work.
print("What is 2 + 2?")
answer = input ()
answer = int(answer)
if answer == 4:
print("Well done")
else:
print("Sorry the answer was 4")
Some will complete this more quickly than others, so ask them to add more questions to their game
while waiting. Once the class have all tested their games, debugged them and run them successfully,
we need to see if the pupils can explain some of the new things in this program.
1. answer = int(answer) - thinking back to use of integers last lesson, what does this do
and what does ‘int’ mean? Answer- this converts a text string into a number or integer. If
we did not convert it to an integer, we could not compare it to another integer, the answer 4.
2. If answer = = 4: - What does the ‘= =’ translate to in plain English Answer- this means
‘equal’ to, as “in is it equal to?”
3. What does the ‘else’ translate to in plain English? Answer-this translates as ‘or else’
4. Why are the indents necessary after the if and else statements? Answer- this means
follow these instructions if the statement above is true
5. What happens if the colons are not there after the 4 or else? You get a Syntax Error
The Ethics of AI:
Open this unit of work from here: 8.4 AI Ethics (Web view)