Session 9 - Variables in App Lab
Session 9 - Variables in App Lab
Artificial Intelligence
Review App Lab
2
Amazon Future
Engineer
Introduction of AI
Session 09
(Time limit: 2 hours)
What is Variable?
Types of Variables
Examples of Variable
Ø Design Elements
Introduction to Math
Hands-on-project
3
Purpose Objective
Learners will learn about variables, design Students will be able to:
elements and Introduction to math. Add the control buttons, text input, text
They will use code.org to explore the App lab area and dropdown elements.
and create an app. Able to learn how to store information in
variable.
5
Types of Variables
variables.
Ø Number – 1,2,3,4,5,etc.
6
Components of Variables
Two components of variable – Variable name and Variable value
Keyword
7
Examples of Variables
to it.
10
Activity
Enter the
values inside
the text
input.
16
Design Elements
Text area:
The text area is used to enter one or more lines of text .
Enter the
text inside
the text area.
Entered
text will
appear here.
17
Design Elements
Dropdown:
The list of choices that appears on a computer screen when a person clicks on the
dropdown option.
18
Code Interface
getNumber():
• Gets the number from the specified screen element.
• To capture numeric data entered by the user your apps will need to read data
from text input().
setNumber():
• Sets the number for the specified screen element.
• Your apps will sometimes need to change, or clear, the numbers displayed.
• setNumber() can be used to update the number on a textInput, textLabel,
button.
15
Code Interface
Declare a variable:
• Declares a variable with the given name.
• Variable names cannot have spaces or special
characters. In practice, it is helpful to name
your variables in a way that describes the
value they store. For instance, if the variable
you create is to store a Score of project you
might name that variable Score.
Assign variable:
• Assign a value to a variable
• The variable getting the value always goes on
the left-hand side of the assignment operator
=. The right-hand side of the assignment
operator can be a number or a string, or the
number or string returned by a function, or
the numeric or string result of the evaluation
of an expression.
16
Code Interface
21
Project Links
Q1. A ________ is a container that holds information that you can access.
a) Questions b) Variable
23
Let's Summarize!
Q1. A ________ is a container that holds information that you can access.
a) Questions b) Variable
24
“Education is the most powerful weapon which
you can use to change the world.”
--Nelson Mandela
THANK YOU
21