1.5.2

Boolean & Assignment Operators 2

Test yourself on Boolean & Assignment Operators 2

After reading these notes, test your knowledge with free interactive questions on Seneca — used by over 10 million students.

Boolean Operators

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

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.
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.
Not

Not

  • '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

  • Assignment is done using the = operator. For example:
    • x = 50
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
Jump to other topics
1

Introduction to Python

2

Data Structures

2.1

Lists & Strings

2.2

File Handling

3

Modularity

3.1

Subroutines

3.2

Data Flow

4

Good Practice

4.1

Naming & Whitespace

4.2

Comments

4.3

Exceptions

Practice questions on Boolean & Assignment Operators 2

Can you answer these? Test yourself with free interactive practice on Seneca — used by over 10 million students.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
Answer all questions on Boolean & Assignment Operators 2

Unlock your full potential with Seneca Premium

  • Unlimited access to 10,000+ open-ended exam questions

  • Mini-mock exams based on your study history

  • Unlock 800+ premium courses & e-books

Get started with Seneca Premium