0% found this document useful (0 votes)
55 views7 pages

Worksheet 8.1. Conditional Algorithms

This document contains examples of using conditional statements in algorithms. It discusses: 1) IF-THEN-ELSE conditionals which perform one action if a condition is true and another action if it is false. Examples are provided like using a computer vs phone for class. 2) AND/OR conditionals which allow checking multiple conditions using AND to require all conditions be true or OR for if either is true. An example checks if homework is done AND the dog is walked. 3) Worksheets provide exercises on conditional logic, unscrambling words, and self-evaluation questions. Real-world scenarios are used like withdrawing money to demonstrate applying conditional logic.

Uploaded by

Edwar Rey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views7 pages

Worksheet 8.1. Conditional Algorithms

This document contains examples of using conditional statements in algorithms. It discusses: 1) IF-THEN-ELSE conditionals which perform one action if a condition is true and another action if it is false. Examples are provided like using a computer vs phone for class. 2) AND/OR conditionals which allow checking multiple conditions using AND to require all conditions be true or OR for if either is true. An example checks if homework is done AND the dog is walked. 3) Worksheets provide exercises on conditional logic, unscrambling words, and self-evaluation questions. Real-world scenarios are used like withdrawing money to demonstrate applying conditional logic.

Uploaded by

Edwar Rey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Conditional Algorithms

Worksheet 8.1
Match parts of the sentences from the three columns to make logical statements.

• If you like • then take • else


fast food, sunglasses, study
somethi
ng else.
• If you like • then study • else get
felines, programmin a dog.
g,
• If you have a • then go to • else take
facemask, McDonald´s, an
umbrella
.
• If you are • then get a • else stay
good at cat, at home.
Mathematic
s,
• If it is sunny, • then you • else eat
can go vegetabl
outside, es.
WORKSHEET 8.2
• Unscramble the letters and write the word.
1.Esel
2.Svedice
3.Loxpmce
4.Sceioch
5.arlvese

6.htob
7.altseat
8.kechc
9.widarhtw
10.MTA

B. Complete the sentences using the words in exercise A.

• The wolf and fox are _______ wild animals.


• The company has a __________ organizational structure.
• My mom gives the cards to someone _________
• But now there are two _______ for us
• ____________ of the students have taken the exam.
• Clean and rinse your hair _______twice a week.
• I _______ my emails every day.
• Laura _________some money from the ________
• But now there are two _______ for us
• I buy a new computer _________

WORKSHEET 8.3
Reading text
Conditionals and how they are used in Algorithms
A CONDITIONAL is a type of a step in an algorithm where a decision must be made. In this
article, we will focus on two types of CONDITIONALS: IF-THEN-ELSE and AND/OR conditionals.
IF-THEN-ELSE CONDITIONALS

One of the first things that programmers learn is how to use IF-THEN-ELSE conditionals. The
basic idea is: IF some condition is true THEN do this, ELSE do that.

For example, imagine you have to connect to an online class, and you have two devices: a
computer and a cellphone. You prefer to use the computer, but your computer is sometimes
blocked. So the CONDIIONAL for your situation is: IF the computer works well THEN connect
with the computer, ELSE connect with the cellphone.
Sometimes, you can have complex conditional statements when you have more than two
choices. As humans, make decisions with several options in a very different way than
computers. We have the ability to select one item out of a group of choices, but a computer
program has to make binary decisions, meaning that it can only select between two things at a
time.

Imagine you want to go to a restaurant. You top-favorite is a pizza restaurant, your second
favorite is a hot-dog restaurant, and your third favorite is a burger restaurant. There are no
more restaurants in your town. Your CONDITIONAL for this situation is:
• IF pizza restaurant is open,
• THEN go to pizza restaurant
• IF hot-dog restaurant is open,
• THEN go to hot-dog restaurant
• IF burger restaurant is open,
• THEN go to burger restaurant
• ELSE cook at home
All the options after the one that is selected are completely ignored. For example, if the pizza
restaurant is open, the computer program will ignore hot-dog and burger restaurants. When
writing your program, it is important to think about the priorities.

AND/OR CONDITIONALS
If you want to check multiple conditions, you can use AND/OR statements. Using AND will cause
the program to do something if both conditions are true. Using an OR statement will do
something if one of the conditions is true.
*imagen de un niño/niña jugando futbol, otra – sacando un perro, otra – estudiando*

Imagine you want to go to play soccer, but your mother says that you should do homework and
walk the dog first. For this situation, the CONDITIONAL is: IF I finished homework AND I walked
the dog, THEN I go to play soccer, ELSE I stay at home. Now, imagine a different situation – you
want to participate in a school competition in Mathematics; to participate, you have to study
minimum in the 9th grade or you have to be minimum 15 years old. In this case, the
CONDITIONAL is: IF I study in 9th grade or higher OR I am at least 15 years old, THEN I can
participate in Mathematics competition, ELSE I cannot participate.
WORKSHEET 8.4

EVALUATION
Write a CONDITIONAL for each situation using the programming language you learned today:
IF, THEN, ELSE, AND, OR.

• Your flight is at 5 pm. You have to be at the airport at least 1 hour before. You get to the
airport on time, you take the flight. You don´t get to the airport on time, you buy a new
ticket.

If
• You want to withdraw 10 000 pesos from the ATM. You have 10 000 or more in your
account, you get the money. You have less than 10 000 in your account, you get nothing.

If you have 10 000 o more in your account, then you get the money else you get nothing

• You want to take salsa classes. Salsa classes start at 3 pm. Your university classes finish
before 3 pm, you take salsa classes. Your university classes finish after 3 pm, you don´t take
salsa classes.

If your university classes finish before 3 pm and salsa classes start at 3pm the you take salsa classes else
you don't take salsa classes
WORKSHEET 8.5

SELF –EVALUATION
Answer the following self-evaluation questions:

• La estrategia de Previewing & Predicting me ayudó a tener una idea de qué se trata el texto.
Si No Tal vez

• Entiendo cómo se usan los CONDICIONALES en algoritmos.


Si No Tal vez

• Puedo aplicar los CONDICINALES a situaciones de vida cotidiana.


Si No Tal vez

You might also like