Source: https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/1-5-2-boolean-and-assignment-operators-2

[Revision notes](https://senecalearning.com/en-gb/revision-notes.md) › [GCSE](https://senecalearning.com/en-gb/revision-notes/gcse.md) › [Coding](https://senecalearning.com/en-gb/revision-notes/gcse/coding.md) › [National Curriculum](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum.md) › Boolean & Assignment Operators 2

# Boolean & Assignment Operators 2

Coding: Introduction to Python v3, topic 1.5.2

## Boolean Operators

Boolean operators perform logical operations and always result in True or False values.

### And

![And](https://image-v2.cdn.app.senecalearning.com/2018-08/a66a8e65-8566-4b75-ba0f-09c1dca1b8bc/business-man-computer-.jpg)

- 'and' evaluates to True only if both operands are True.
 - True and True = True.
 - True and False = False.
 - False and True = False.
 - False and False = False.

### Or

![Or](https://image-v2.cdn.app.senecalearning.com/2018-08/789909dc-f5d8-4151-97cf-5012e4f86af3/coding-1853305_1920.jpg)

- 'or' evaluates to True if any of the two operands are True:
 - True or True = True.
 - True or False = True.
 - False or True = True.
 - False or False = False.

### Not

![Not](https://image-v2.cdn.app.senecalearning.com/2018-09/dd9a5e37-3238-4caf-952a-e2b22969df54/minus-negative-.png)

- 'not' negates a logical value.
 - not True = False.
 - not False = True.

## Assignment Operators

Assignment operators allow us to give a variable a value, or to update its value.

### Assignment

![Assignment](https://image-v2.cdn.app.senecalearning.com/courseImages/physics/AQA%20New%20Modules/1.3.1/chalk%20board%20equals%20sign.jpg)

- Assignment is done using the = operator. For example:
 - x = 50

### Updating

![Updating](https://image-v2.cdn.app.senecalearning.com/courseImages/physics/1.5.1%20Energy%20Changes/wires%20-%20Edited-min.jpg)

- We can also use special assignment operators to update the value of a variable, for example:
 - x += 50 is the same as x = x + 50
 - x %= 50 is the same as x = x % 50

## Test yourself on Boolean & Assignment Operators 2

- Which Boolean operator takes only one value as input?
- What does the following expression in Python return?
False or True
- Which of these statements are equivalent to x = x - 5?
- What is the result of x += 50?
- Which of the following are valid assignment operators?

[Practise this topic for free](https://app.senecalearning.com/classroom/course/72d0364c-db0a-4630-8e0a-61f48cae0252/section/98fa9447-ce06-4249-8704-4886c477a2c0/session)

- Previous topic: [1.5.1 Arithmetic & Relational Operators](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/1-5-1-arithmetic-and-relational-operators.md)
- Next topic: [1.6.1 Selection](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/1-6-1-selection.md)

## Coding: Introduction to Python v3 contents

### 1 Introduction to Python
- 1.1 Python
  - [1.1.1 Python](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/1-1-1-python.md)
- 1.2 Input & Output
  - [1.2.1 Input & Output](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/1-2-1-input-and-output.md)
- 1.3 Data Types
  - [1.3.1 Data Types](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/1-3-1-data-types.md)
- 1.4 Variables & Constants
  - [1.4.1 Variables & Constants](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/1-4-1-variables-and-constants.md)
- 1.5 Operators
  - [1.5.1 Arithmetic & Relational Operators](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/1-5-1-arithmetic-and-relational-operators.md)
  - [1.5.2 Boolean & Assignment Operators 2](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/1-5-2-boolean-and-assignment-operators-2.md)
- 1.6 Program Flow
  - [1.6.1 Selection](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/1-6-1-selection.md)
  - [1.6.2 Iteration](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/1-6-2-iteration.md)

### 2 Data Structures
- 2.1 Lists & Strings
  - [2.1.1 Lists](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/2-1-1-lists.md)
  - [2.1.2 Strings](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/2-1-2-strings.md)
- 2.2 File Handling
  - [2.2.1 File Handling](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/2-2-1-file-handling.md)

### 3 Modularity
- 3.1 Subroutines
  - [3.1.1 Subroutines](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/3-1-1-subroutines.md)
- 3.2 Data Flow
  - [3.2.1 Data Flow](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/3-2-1-data-flow.md)

### 4 Good Practice
- 4.1 Naming & Whitespace
  - [4.1.1 Identifiers](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/4-1-1-identifiers.md)
  - [4.1.2 Whitespace](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/4-1-2-whitespace.md)
- 4.2 Comments
  - [4.2.1 Comments](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/4-2-1-comments.md)
- 4.3 Exceptions
  - [4.3.1 Exceptions](https://senecalearning.com/en-gb/revision-notes/gcse/coding/national-curriculum/4-3-1-exceptions.md)
