Computer Science Core Concepts What is Computer Science

  • Slides: 28
Download presentation
Computer Science Core Concepts

Computer Science Core Concepts

What is Computer Science? Computer Science is the creation and adaptation of technology

What is Computer Science? Computer Science is the creation and adaptation of technology

What is programming?

What is programming?

Programming Instructions for a computer to follow to perform a task

Programming Instructions for a computer to follow to perform a task

What is an algorithm?

What is an algorithm?

Algorithms A process to follow to solve a problem; a set of instructions

Algorithms A process to follow to solve a problem; a set of instructions

What is A variable?

What is A variable?

Variable A symbol or name that represents a value Can declare, assign or change

Variable A symbol or name that represents a value Can declare, assign or change the value of variables

What is Boolean?

What is Boolean?

Boolean A data type that returns only true or false. It will not return

Boolean A data type that returns only true or false. It will not return numbers*, words, etc. . True=1 False=0 *the only numbers Boolean will return

What is A Comparator?

What is A Comparator?

Comparato rs (aka Logic operators) Compare two or more Variables The result of the

Comparato rs (aka Logic operators) Compare two or more Variables The result of the comparison is a boolean value Equal to == and Not equal to != or Greater than > not Greater than or equal to >= Less than < Less than or equal to <=

Comparators (con’t) x = 10 y = 20 What is the boolean value of

Comparators (con’t) x = 10 y = 20 What is the boolean value of the following expressions? ● x == y ● x != y ● x>y ● x >= y ● x<y ● x <= y

What is An if-else statement?

What is An if-else statement?

If-Else Statements When a comparison is True, then the if- block will be executed.

If-Else Statements When a comparison is True, then the if- block will be executed. And, if a comparison is False, then the elseblock will be executed.

If-Else Statements examples x=8 y=4 What is the boolean value of the following expressions?

If-Else Statements examples x=8 y=4 What is the boolean value of the following expressions? if (x > y and y != 5) print (“Hello!”) else print (“Bye!”) if ((x-y)==4) else print (“Bonjour!”) print (“Au revoir!”) if (x < y or x >= 5) print (“Hola!”) print (“Adios!”) else

What is Branching?

What is Branching?

Branching A branch is a set of instructions that, when executed, cause the computer

Branching A branch is a set of instructions that, when executed, cause the computer to begin execution of a different instruction sequence. Branching can use if-else or switch statements

What is a loop?

What is a loop?

LOOPS Series of instructions that is repeated until a given condition is false

LOOPS Series of instructions that is repeated until a given condition is false

LOOPS (Types) for loop: executed at least once, and the number of repetitions is

LOOPS (Types) for loop: executed at least once, and the number of repetitions is known while loop: repeatedly executed statement; will be executed 0 infinity times

What is iteration?

What is iteration?

Iteration is the act of repeating a process Each time a loop runs, that

Iteration is the act of repeating a process Each time a loop runs, that is one iteration.

What is a function?

What is a function?

Functions A small set of instructions that defines how to complete a specific task

Functions A small set of instructions that defines how to complete a specific task The “Add ten to a number” is the function

Computer Science Algorithm You learned about. . . Programming Variable Boolean If/Else Comparators Loops

Computer Science Algorithm You learned about. . . Programming Variable Boolean If/Else Comparators Loops For Loop While Loop

Review!

Review!