Archive for February, 2018

Koadables

https://game.kodable.com/play?hc=1&user=ss8inpl


Introducing Electricity and simple circuits

Watch the Brainpop movie On Electricity https://www.brainpop.com/science/energy/electricity/

What is electricity/ Blog here what you have learned.


Conditionals

Koadable Link https://game.kodable.com/

Before we start conditionals lets review Sequence and Loops

Programming Flow Control Structures: The flow control structure is 3 ways that programers make computers do things.

  • Sequence
  • Conditions Today we look at Conditions. 
  • Loops

What is a condition?

Conditions (conditional expressions) are the second of three basic flow control structures in programming. Like sequence, conditions influence a computer program’s decision-making process.

“If, then” Statements

 

PastedGraphic-1

Also known as “if, then” logic statements, conditions enable a computer program to act differently each time it is executed; depending on if an input is evaluated to be either true or false.

In a programming language, conditions are classic “if, then” logic statements and possess both a hypothesis and conclusion.

What is a hypothesis: It is an educated Guess. YOu predict what will happen based on what you observe.

 

Hypothesis:

 If I have the proper ingredients for my sandwich…

Conclusion:

…then I can get a knife.

 Hypothesis:

If I do not spread the peanut butter …

 Conclusion:

then I cannot make my sandwich.

Why are conditions important?

Conditional statements are important to any computer program because they enable programmers to develop more dynamic programs. What makes computer programs so great is that they can interact with the user. Without conditions, this type of interaction would be impossible.

Can you see conditionals on this page below?

PastedGraphic-1

Evaluating Conditional Expressions

In order to prepare our peanut butter and jelly sandwich, we had to evaluate whether or not the necessary conditions were met as we went through

our algorithm. If any of these conditions were evaluated to be false, then our peanut butter and jelly sandwich could not be made.

The exact same principles apply when using conditions in computer programming:

Simple Conditions: Passwords

A classic example of a simple condition is a password. A password secures your computer and all of your personal information. When a user enters a password, the program needs to evaluate this input, and check whether or not the password entered matches the correct one saved for the user.

Hypothesis:

If the user input matches the password stored in the database…

Conclusion:

then the user can access their profile and personal information.

Rules

A rule is a set of guidelines in a programming language that instruct a computer program what operations to execute or perform. For example, the rule in a password program is to never let users access secured and private data.

Conditions modify programs and are rule breakers, or exceptions, to the rule.

For example, we would create a condition for a password program that would enable specific users to access their secured information.

Hypothesis:

 If a user input matches the password stored in the database…

 Conclusion:

 …then the user can access their secured profile/information.

Show Less


Conditions Vocabulary

Terms and Definitions

  1. Condition: A condition is an exception to a rule, and is also known as a rule-breaker. A condition in program allows the program to perform different actions, depending on the condition being true or false.
  2. Conditional Statement: A conditional statement allows programmers to develop more dynamic programs by breaking rules. Conditional statements are “If, then” statements: If a condition is true, then do _(x)_.
  1. Username: When used with a password, allows a user to log into the database and access information. A rule-breaker.
  2. Password: When matched with a username, allows a user to log into the database and access information. A rule-breaker.
  1. Rule: A rule is a set of guidelines in a programming language that instruct a computer program to execute or perform certain operations.
  2. Exception: Excluded from a general statement, does not follow a rule. A condition is an exception to the rule.
  3. Rule-breaker: Exceptions to the rule. An example in programming is a password.
  4. “If… then…” statement: A logic statement, when used in programming enable a computer program to act differently each time it is executed depending on if an input is evaluated to be either true or false.

 

 

 


Welcome Back and Conditionals


test


Conditions


Conditions For Class on 2/26


Flow Control Structures Reveiw:For Ms. Schron’s class

Flow Control Structures: The programmer’s tools to get a computer to do something or take a specific action. There are three flow control structures in programming: sequence, conditions, and loops.

Sequence  Also called order of events.Sequence is the order you write your code in.

Loops Refers to repeating of a line of code written. In Scratch think of the Repeat button or Forever Button that allows you to write one line of code repeat it many times.

Conditional – The “if you do this, then this happens” statements in code. “if the user types his password then he gets into the website. In Scratch, if you press the flag then the Sprite does something.

Algorithm

Set of Steps in a specific order not necessarily in computer code to complete a task

Here are a set of online flash cards to study the definitions of these coding terms.

Click here for Flash Cards

http://www.cram.com/flashcards/coding-terms-9529257

SEQUENCE DEMAND THAT THE CODE BE EXECUTED EXACTLY AS WRITTEN IN THE SAME ORDER

COMPARE THESE TWO CODES. 

ANSWER THE QUESTION DO THEY HAVE ALL THE SAME BLOCKS? ARE THEY IN THE SAME ORDER? DO YOU THINK THE OUTCOME OF THE EXECUTED CODE WILL BE THE SAME?

IF YOU SAID NO YOU WOULD BE RIGHT.

 


Flowcab on “Events” In code.

Lets Kahoot  Here

What is an Event? Flowcab answers this question nicely!  https://www.flocabulary.com/unit/coding-events/vocab/

Event

noun – an action that causes something else to happen in a computer program.

The video paused in response to the event of me pressing the spacebar.

Action (noun) something performed by a user that causes a program to respond.

The action of me clicking the icon caused the program to launch.

Event handler (noun) a bit of code that listens for a discrete event and executes a given reaction when the event occurs.

The event handler makes my character jump when I press the m key. In pseudocode, it reads “when m pressed, character jumps.”

Interactive (adjective) allowing two-way communication between a computer and a person.

Most computer games are highly interactive.


Scratch On!!!! Make one Letter Chase another Letter.

Here is the link to the  other CS Movie