kurt_allen
kurt_allen 4d ago • 10 views

Steps to using 'not' operator in Python with examples

Hey there! 👋 Let's dive into the 'not' operator in Python. It's super useful for making your code do the opposite of what it normally would. I'll explain it simply, and then we'll test your knowledge with a quick quiz! 🤓
💻 Computer Science & Technology
🪄

🚀 Can't Find Your Exact Topic?

Let our AI Worksheet Generator create custom study notes, online quizzes, and printable PDFs in seconds. 100% Free!

✨ Generate Custom Content

1 Answers

✅ Best Answer
User Avatar
cynthia.davis Jan 3, 2026

📚 Quick Study Guide

  • 🔍 The not operator in Python is a unary operator that performs logical negation.
  • 💡 It reverses the truth value of a boolean expression. If an expression is True, not makes it False, and vice versa.
  • 📝 The syntax is simple: not expression.
  • 💻 It's commonly used in conditional statements (if, elif, else) and loops (while) to control program flow.
  • ✅ Example: not (5 > 3) evaluates to False because (5 > 3) is True.
  • 🧠 Remember that not has lower precedence than most other operators, so use parentheses for clarity.

Practice Quiz

  1. What is the result of not True?

    1. True
    2. False
    3. None
    4. Error
  2. What is the result of not False?

    1. True
    2. False
    3. None
    4. Error
  3. What will be printed when the following code is executed?

    x = 5
    if not x > 10:
        print("Hello")
    else:
        print("World")
    1. Hello
    2. World
    3. Error
    4. Nothing
  4. What is the result of not (10 == 5)?

    1. True
    2. False
    3. None
    4. Error
  5. Which of the following is the correct syntax for using the not operator?

    1. not expression
    2. expression not
    3. !expression
    4. expression!
  6. What will be printed when the following code is executed?

    x = True
    y = False
    if not x and not y:
        print("Both are False")
    else:
        print("At least one is True")
    1. Both are False
    2. At least one is True
    3. Error
    4. Nothing
  7. What is the result of not (not True)?

    1. True
    2. False
    3. None
    4. Error
Click to see Answers
  1. B
  2. A
  3. A
  4. A
  5. A
  6. B
  7. A

Join the discussion

Please log in to post your answer.

Log In

Earn 2 Points for answering. If your answer is selected as the best, you'll get +20 Points! 🚀