Part 1 How are we doing so far Introduction to Raspberry Pi and Kano 2 Learning Agenda Week 4 Introduction to Boolean Logic Father of Boolean Logic And Or Not Conditions Why do we need this logic ID: 814778
Download The PPT/PDF document "Advanced Programing in MakeArt" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Advanced Programing
in
MakeArt
(Part 1)
Slide2How are we doing so far?
Introduction to Raspberry Pi and Kano
2
Slide3Learning Agenda – Week 4
Introduction to Boolean Logic
Father of Boolean Logic
And, Or, Not
ConditionsWhy do we need this logic?
No More Training WheelsFunction Definition StructureVariable Definition StructureWrite Your Own CodeCreate and use custom functionCreate and use custom variables
Conditional (IF) Programming LogicEqual To and Not Equal ToGreater Than and Less ThanIntroduction to Raspberry Pi and Kano
3
Slide4Introduction to Boolean Logic
Introduction to Raspberry Pi and Kano
4
He was an English mathematician, educator, philosopher and
logician
. He worked in the fields of differential equations and algebraic logic, and is best known as the author of
The Laws of Thought
which contains Boolean algebra. Boolean logic is credited with laying the foundations for the information age.
George Boole
Nov, 2 1815 – Dec, 8 1864
Let’s Start Thinking in Boolean
1 = True
0= False
Slide5Boolean Logic - AND, OR, NOT
AND (conjunction), denoted
X
∧Y or sometimes X AND YThe Rule:
X∧Y = 1, If and only if X = 1 and Y = 1All other cases are 0
Introduction to Raspberry Pi and Kano5
X
Y
Slide6Boolean Logic - AND, OR, NOT
OR (disjunction), denoted
X
∨Y or sometimes X OR
YThe Rule: X∨Y = 0, If and only if X = 0 and Y
= 0All other cases are 1Introduction to Raspberry Pi and Kano
6
X
Y
Slide7Boolean Logic - AND, OR, NOT
NOT (negation), denoted ¬
X
or sometimes NOT XRule ¬
X = 0, If and only if X = 1Rule ¬X = 1, If and only if X = 0
Introduction to Raspberry Pi and Kano7
X
Slide8The
Truth Tables
Aren't Lying
X
Y
X∧Y
0000
101
0
0
1
1
1
Introduction to Raspberry Pi and Kano
8
X
Y
X∨Y
0
0
0
0
1
1
1
0
1
1
1
1
X
¬X
0
1
1
0
AND
OR
NOT
Slide9Conditions Result in Boolean Results
Logical statements are either True or False.
For a value of X and Y evaluate the following statements:
If X == Y = ?
If X < Y = ?If X > Y = ?If X >= Y = ?If X <= Y = ?If X != Y = ?What other conditions can we have?
Introduction to Raspberry Pi and Kano9
Slide10Why do we need logic?
Introduction to Raspberry Pi and Kano
10
To control what a program will do and how it will do it.
Slide11No More Training Wheels
You knew it was coming…
Introduction to Raspberry Pi and Kano
11
Slide12What’s a Function?
In programming, a
named section
of a program that performs a specific task. In this sense, a function is a type of
procedure or routine.
Introduction to Raspberry Pi and Kano12
Function Body
Return Statement
Return Value
Function Name
Function Arguments
Slide13What’s a Variable?
In computer programming, a
variable
or scalar
is a storage location paired with an associated symbolic name, which contains some known or unknown quantity of information referred to as a value.
Introduction to Raspberry Pi and Kano
13
Assignment Operator
Value of String Type
Variable Name
Value of Integer Type
Slide14What’s a Function?
In programming, a
named section
of a program that performs a specific task. In this sense, a function is a type of
procedure or routine.
Introduction to Raspberry Pi and Kano14
Function Body
Return Statement
Return Value
Function Name
Function Arguments
Return Type
Slide15What’s a Variable?
In computer programming, a
variable
or scalar
is a storage location paired with an associated symbolic name, which contains some known or unknown quantity of information referred to as a value.
Introduction to Raspberry Pi and Kano
15
Assignment Operator
String Literal
Variable Name
Integer Value
Semicolon End of Statement
Variable Type
Namespace
Variable Type
Slide16My First Program With Variables
Introduction to Raspberry Pi and Kano
16
Slide17Call me if you need that done! - Functions
Introduction to Raspberry Pi and Kano
17
Slide18Are you the same? – Equals Logic (==)
Introduction to Raspberry Pi and Kano
18
Slide19To Be or Not To Be – Not Equals Logic (!=)
Introduction to Raspberry Pi and Kano
19
Slide20Are you smaller?– Less Than (<)
Introduction to Raspberry Pi and Kano
20
Slide21Are you larger?– Greater Than (>)
Introduction to Raspberry Pi and Kano
21
Slide22Week 4
- Review
Who is the father of Boolean logic?
What is a conditional? (give an example)What is the result of a condition?
Why do we need logic?Give an example of AND logic.Give an example of OR logic.Give an example of NOT logic.
Introduction to Raspberry Pi and Kano
22