# Working with Operators

Practice Labs Module
Time
6 minutes
Difficulty
Intermediate

Welcome to the Working with Operators Practice Lab. In this module, you will be provided with the instructions and devices needed to develop your hands-on skills.

Join over 3 million cybersecurity professionals advancing their career
or

Overview

### Introduction

Welcome to the Working with Operators Practice Lab. In this module, you will be provided with the instructions and devices needed to develop your hands-on skills.

### Learning Outcomes

In this module, you will complete the following exercise:

• Exercise 1 - Working with Arithmetic, Comparison, and Logical Operators

After completing this lab, you will be able to:

• Use the arithmetic, comparison, and logical operators in Python programs

### Exam Objectives

The following exam objectives are covered in this lab:

• 1.3 Determine the sequence of execution based on operator precedence
• 1.4 Select the appropriate operator to achieve the intended result

### Lab Duration

It will take approximately 20 minutes to complete this lab.

### Exercise 1 - Working with Operators

In a programming language, operators help you to carry out numerical or logical computations. The operators perform computations on operands (variables with values). The operators are available in the form of various symbols. They are categorised into different types based on the nature of computations in the programs. For example, if you want to add two numbers such as 10 and 20, the numbers 10 and 20 are known as the operands. The addition symbol ‘+” is known as the operator.

In Python, the different types of operators are as follows:

• Arithmetic: The arithmetic operators help to perform numerical calculations such as addition, subtraction, multiplication, division, finding modulus, exponentiation, and floor division in programs.
• Comparison: The comparison operators help to compare the values of the variables, expressions, or results. These operators are also known as relational operators as they determine the relationship between the operands.
• Logical: The logical operators help to arrive at decisions under specific conditions. These operators return a value of either true or false based on the conditions in the programs.
• Bitwise: The bitwise operators are used in expressions or computations that involve bits.
• Membership: The membership operators are used in expressions or computations that involve a sequence of values such as lists or strings. These operators return a value of either true or false.
• Identity: The identity operators compare the memory locations of the variables used in expressions or computations.
• Assignment: The assignment operators are used to assign values to the variables after performing arithmetical operations in numerical expressions or calculations.

In this exercise, you will learn to use the arithmetic, comparison, and logical operators in Python programs.

### Learning Outcomes

After completing this exercise, you will be able to:

• Use the arithmetic, comparison, and logical operators in Python programs
Learning Partner
Comprehensive Learning

See the full benefits of our immersive learning experience with interactive courses and guided career paths.