Search Header Logo
Comparison & Logical Operators

Comparison & Logical Operators

Assessment

Presentation

Computers

6th Grade

Practice Problem

Hard

Created by

ANDRES FELIPE GOMEZ-CASSERES ESPINOSA

Used 44+ times

FREE Resource

11 Slides • 5 Questions

1

Comparison & Logical Operators

By Andrés

2

​Warm Up

In this warm-up, you will face some questions about comparison operators. It has five questions, each harder than the previous one.

3

Draw

Draw the symbol used to represent a conditional in flowcharts

4

Fill in the Blank

Question image

The central part of a conditional is called

5

Draw

Draw the not equal to operator

6

Multiple Choice

If you want to know if the variable AGE is greater than 45, which comparison operator can you choose?

Remember that the condition must follow the form: variable OPERATOR number.

1
>=
2
<
3
>
4
==

7

Multiple Select

Johan (Reasoning) wants to know if he has enough money to buy a brand-new computer that costs USD 1200. Which conditions can you use to build a program that tells Johan if he can buy the computer?

1

Johan_money > 1200

2

Johan_money < 1200

3

Johan_money >= 1200

4

Johan_money == 1200

8

media

In programming, you often want to compare a value with another value. To do that, you use comparison operators.

Comparison Operators

9

You will need them when you want to make a choise in your code. Therefore, you will always see these operators inside conditionals (forming the condition)

Comparison Operators

media

10

Let's check this problem together

Create a flowchart that asks the user for a day of the week. If the day of the week is a weekday, the program should print "Go to school." Otherwise, the program should print "Enjoy your weekend!"

11

A logical operator is a symbol or word used to connect two or more expressions (conditions) such that the value of the compound expression produced depends only on that of the original expressions and on the meaning of the operator.

Formal definition

What are logical operators?

​Operand

​AND

​OR

​NOT

​Meaning

​Returns True if both conditions are true

​Returns true if either condition are true

Reverses a result, so if something is True, not turns it False

12

Create a flowchart that asks the user for a day of the week. If the day of the week is a weekday, the program should print "Go to school." Otherwise, the program should print "Enjoy your weekend!"

What are logical operators for?

13

Create a flowchart that asks the user for a day of the week. If the day of the week is a weekday, the program should print "Go to school." Otherwise, the program should print "Enjoy your weekend!"

What are logical operators for?

Which conditions does the problem have?

14

Create a flowchart that asks the user for a day of the week. If the day of the week is a weekday, the program should print "Go to school." Otherwise, the program should print "Enjoy your weekend!"

What are logical operators for?

Which conditions does the problem have?

day == "Saturday"

day == "Sunday"

15

Create a flowchart that asks the user for a day of the week. If the day of the week is a weekday, the program should print "Go to school." Otherwise, the program should print "Enjoy your weekend!"

What are logical operators for?

Which conditions does the problem have?

day == "Saturday"

day == "Sunday"

OR

16

Activity

We are going to play with conditions
and with your classmates

Comparison & Logical Operators

By Andrés

Show answer

Auto Play

Slide 1 / 16

SLIDE