0% found this document useful (0 votes)
4 views

Year 7_Python Operators_Apr 29-May 3 2024 (1)

The document outlines the learning objectives and success criteria for understanding and applying various operators in Python, including arithmetic, comparison, logical, and assignment operators. It provides examples of how to use these operators in code snippets and includes activities for practice. Additionally, it emphasizes the importance of recognizing the differences between operators such as '==' and '='.

Uploaded by

samina65938
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Year 7_Python Operators_Apr 29-May 3 2024 (1)

The document outlines the learning objectives and success criteria for understanding and applying various operators in Python, including arithmetic, comparison, logical, and assignment operators. It provides examples of how to use these operators in code snippets and includes activities for practice. Additionally, it emphasizes the importance of recognizing the differences between operators such as '==' and '='.

Uploaded by

samina65938
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Python- Revisit Comparison

Operators & Assignment Operators


Python-Variables, Input/Output

LEARNING OBJECTIVE
✓To understand the different types of operators in Python, including
arithmetic, comparison, logical, and assignment operators.
✓To apply operators in Python to solve problems.
SUCCESS CRITERIA
I can:
• Identify and explain the different types of operators in Python.
• Apply operators to solve problems and write simple code snippets.
• Analyze the use of different operators in Python and create code that
utilizes them effectively
Python-Operators
Starter:
Python Revisit
What is the difference between == and = in Python?
Answer: ==: The equality operator. This operator is used to check if two
values are equal. It returns True if the values are equal, and False
otherwise. =: The assignment operator. This operator is used to assign a
value to a variable.

In Python, which operator is used to add two values?


a) -
b) *
c) /
d) +
Answer: +
Python-Operators
Recap
Arithmetic Operators: The program uses * to calculate the cost of each
item based on its price and quantity. It then uses + to sum up the total
cost.
Comparison Operators: The program uses > to check if the total cost
exceeds a certain amount to apply a discount. It also uses >= to check if
the user has enough money to pay for the purchase.
Logical Operators: The program uses a single if statement, but you could
add more complex logical operations if desired.
Assignment Operators: The program uses = to assign values to variables
and -= to update the total_cost variable by applying a discount.
Python-Operators
Must Task

a1 = int(input("Enter the first number: "))


a2 = int(input("Enter the second number: "))

print("Comparing the two numbers:")


print(“Is number1 equal to number 2”, a1 == a2)
Python-Operators
Here's a list of different assignment operators available in Python.
Python-Operators
Python Comparison Operators
Python-Operators
Activity:
Group 1
•Ask the user to input two numbers (num1 and num2).
•Print the result of all the comparison operators as a Boolean (True if the numbers are equal, False if they
are not).

Group 2
•Ask the user to input two ages Print the result of all the comparison operators as a Boolean (True if the
numbers are equal, False if they are not).

Group 3
•Ask the user to input the marks of three subjects
• Use the assignment operator (=) to calculate the average of three marks.
•Print the average of the three marks and print the result of all the comparison operators as boolean

Extended Activity
Create a Python program that converts Celsius to farenheit.
fahrenheit = (celsius * 9/5) + 32
Python-Operators
PLENARY

• What are the four types of operators covered in today's


lesson, and give an example of each?
• What did you find challenging in today's lesson, and how
did you overcome it?
Python-Operators

Success Criteria:

I can:
➢ Identify and explain the different types of operators in Python.
➢ Apply operators to solve problems and write simple code
snippets.
➢ Analyze the use of different operators in Python and create code
that utilizes them effectively.

You might also like