1.5.2
Boolean & Assignment Operators 2
Boolean Operators
Boolean Operators
Boolean operators perform logical operations and always result in True or False values.
![Illustrative background for And](https://image-v2.cdn.app.senecalearning.com/2018-08/a66a8e65-8566-4b75-ba0f-09c1dca1b8bc/business-man-computer-,h_400,q_80,w_640.jpg)
![Illustrative background for And ?? "content](https://image-v2.cdn.app.senecalearning.com/2018-08/a66a8e65-8566-4b75-ba0f-09c1dca1b8bc/business-man-computer-,h_400,q_80,w_640.jpg)
And
And
- '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.
![Illustrative background for Or](https://image-v2.cdn.app.senecalearning.com/2018-08/789909dc-f5d8-4151-97cf-5012e4f86af3/coding-1853305_1920,h_400,q_80,w_640.jpg)
![Illustrative background for Or ?? "content](https://image-v2.cdn.app.senecalearning.com/2018-08/789909dc-f5d8-4151-97cf-5012e4f86af3/coding-1853305_1920,h_400,q_80,w_640.jpg)
Or
Or
- '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.
![Illustrative background for Not](https://image-v2.cdn.app.senecalearning.com/2018-09/dd9a5e37-3238-4caf-952a-e2b22969df54/minus-negative-,h_400,q_80,w_640.png)
![Illustrative background for Not ?? "content](https://image-v2.cdn.app.senecalearning.com/2018-09/dd9a5e37-3238-4caf-952a-e2b22969df54/minus-negative-,h_400,q_80,w_640.png)
Not
Not
- 'not' negates a logical value.
- not True = False.
- not False = True.
Assignment Operators
Assignment Operators
Assignment operators allow us to give a variable a value, or to update its value.
![Illustrative background for Assignment](https://image-v2.cdn.app.senecalearning.com/courseImages/physics/AQA New Modules/1.3.1/chalk board equals sign,h_400,q_80,w_640.jpg)
![Illustrative background for Assignment ?? "content](https://image-v2.cdn.app.senecalearning.com/courseImages/physics/AQA New Modules/1.3.1/chalk board equals sign,h_400,q_80,w_640.jpg)
Assignment
Assignment
- Assignment is done using the = operator. For example:
- x = 50
![Illustrative background for Updating](https://image-v2.cdn.app.senecalearning.com/courseImages/physics/1.5.1 Energy Changes/wires - Edited-min,h_400,q_80,w_640.jpg)
![Illustrative background for Updating ?? "content](https://image-v2.cdn.app.senecalearning.com/courseImages/physics/1.5.1 Energy Changes/wires - Edited-min,h_400,q_80,w_640.jpg)
Updating
Updating
- 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
1Introduction to Python
1.1Python
1.2Input & Output
1.3Data Types
1.4Variables & Constants
1.6Program Flow
2Data Structures
2.1Lists & Strings
2.2File Handling
3Modularity
3.1Subroutines
3.2Data Flow
4Good Practice
4.1Naming & Whitespace
4.2Comments
4.3Exceptions
Jump to other topics
1Introduction to Python
1.1Python
1.2Input & Output
1.3Data Types
1.4Variables & Constants
1.6Program Flow
2Data Structures
2.1Lists & Strings
2.2File Handling
3Modularity
3.1Subroutines
3.2Data Flow
4Good Practice
4.1Naming & Whitespace
4.2Comments
4.3Exceptions
![Go student ad image](/en-GB/revision-notes/_next/image?url=%2Fen-GB%2Frevision-notes%2Fimages%2Fgo-student-uk-ad.jpg&w=640&q=100)
Unlock your full potential with GoStudent tutoring
Affordable 1:1 tutoring from the comfort of your home
Tutors are matched to your specific learning needs
30+ school subjects covered