G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise,...

34
Wǃǃdz 4 GǠȨǶȮ WǝȆ CȆƿǃ MǠƿƿǶǃ SƹǝȆȆǶ

Transcript of G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise,...

Page 1: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

W 4G W CM S

Page 2: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

N

2

Gather in a circle and on the count of three, jump back into a "Ninja" pose.

One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch

another person's hand in a single "Ninja" move.If a person's hand is touched, they are eliminated.

Avoid having your hand touched or slapped and be the last Ninja standing.

Page 3: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

L

3

Split into two groups: the directors and the builders.

The directors should build something using the legos and have a volunteer take a picture of it.

Then disassemble it and give the builders instructions on how to recreate the structure.

Let’s teamwork!

Page 4: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

H BM !Our amazing co-leader!

4

Page 5: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

VWhat is a variable?

Page 6: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

What is a Variable?A variable is like a box with a name.

★ We can put different things (i.e., different values) into the box.

★ When we put something new into the box, we also get rid of what used to be in the box.

6

Page 7: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Let’s Review!var greeting = “Hello World!”

7

Name of our variable

How we assign the

value of our variable

Information we are storing (the data)

Page 8: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

How to Check a Variable’s Value?

We can print the value of a variable onto the screen!

8

print greeting

Hello World!

Page 9: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Why Use Variables★ Reduce

○ We get to write less code!★ Reuse

○ We can use code we wrote before by storing its value in variables!

○ Your program will never ever ever ever forget what’s in your variable!

★ Recycle○ We can replace the value in the variable!

9

Page 10: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Let’s Change What’s in Our Variable!

10

var x = 5

x = 5 + 2

x = x + 5

5

5 7

5 7 12

x

x

x

Page 11: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

The Equal Sign???The equals sign does NOT mean what you

think it means!

11

var greeting = “Hello World!”

Takes the value “Hello World!” and puts it in the variable greeting.

The equals sign is for assignment.It means “put this value in this box.”

Page 12: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Let’s Practice!https://www.khanacademy.org/computer-

programming/new/pjs

var x = 5;var y = 10;x = 2 + 2;x = x + y;

println(x);println(y);

12

What will we print out?

Page 13: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

D TWhat are some data types?

Page 14: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

What Are Some Data Types?

Strings:Booleans:Ints:Floats:Chars:

14

var hello = “Hello World!”;var bool = True;var num = 5;var deci = 3.0;var letter = ‘a’;

Page 15: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Some More Examples

★ Integers○ 1, 586, 785

★ Floats○ 1.0, 1.234, 500.847○ Operators: +, -, ÷, ×

★ Chars○ ‘G’, ‘W’, ‘C’

15

★ Strings○ “Cat”, “Dog”,

“Mouse”★ Booleans

○ True, False○ Operators: not, and,

or

Page 16: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Booleans★ A boolean value can be

either True or False

★ We use these to check if a certain condition is true or not

16

Page 17: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Comparison Operatorsa > b check if a is greater than b

a < b check if a is less than ba === b check if a is equal to b

a !== b check if a is NOT equal to b

exclamation point “!” always means “not”

17

Page 18: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Let’s Practice!

18

>6 4

Page 19: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Let’s Practice!

19

<10 10

Page 20: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Let’s Practice!

20

===10 10

Page 21: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Let’s Practice!

21

!==4 9

Page 22: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Boolean Operators&&

and:True and True ⇒ True

True and False ⇒ FalseFalse and True ⇒ FalseFalse and False ⇒ False

22

Page 23: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Boolean Operators||

or:True or True ⇒ TrueTrue or False ⇒ TrueFalse or True ⇒ True

False or False ⇒ False23

Page 24: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Boolean Operators!

not:not True ⇒ Falsenot False ⇒ True

24

Example: Evaluate not (i < 10) when i = 5.

Can negate anything by

putting “not” in front of it

not (i < 10) => Falsei < 10 ⇒ Truenot (true) ⇒ False

Page 25: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Let’s Practice!

25

&&True True

Page 26: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Let’s Practice!

26

&&5 !== 2 4 > 5

Page 27: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Let’s Practice!

27

||x > 0 5 < x

var x = 8;x = 4;

Page 28: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Let’s Practice!

28

||6 !== y 3 > y!var y = 9;var x = 7;y = y - x;

Page 29: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

CSneak Peak into Conditionals

Page 30: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Conditional★ Conditionals tell the computer

to only do something IF a certain condition is true

30

“If you finish your

homework, you can watch TV.”

“If you listen to Michelle

and Amy, you will learn CS.”

Page 31: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

If, Else If, ElseIF statement★ tells a

program to do something IF a certain condition is true

ELSE IF statement★ comes after the IF

statement★ tells the program what

to do if the first condition is false, but a different condition is true

★ optional★ can have as many as

you want

The ELSE statement★ goes last★ tells the program

what to do if none of the conditions for the IF and ELSE IF statements are true

31

Page 32: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

Examplevar michelle_age = 22;if (michelle_age < 21) {

print “I’m in school!”;} else if (michelle_age === 21) {

print “It’s not my birthday yet!”;} else if (michelle_age === 22) {

print “It’s my birthday!”;} else {

print “What is my age?”;}

32

False

False

It’s my birthday!

Page 33: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

W T !Get out your pens and pencils!

33

Page 34: G W C - WICC · 2019-03-04 · into a "Ninja" pose. One-by-one and continuing counter-clockwise, each person takes a turn being the attacker and tries to touch another person's hand

34

C T !Let’s get on Khan Academy!

Please also fill out the Happiness Survey!

H Shttps://goo.gl/forms/AtEPT5j0

2fC3vCHA2