Bird
0
0

What will be the output of this code?

medium📝 Predict Output Q5 of 15
Python - Operators and Expression Evaluation
What will be the output of this code?
text = "hello world"
print('w' in text)
print('z' not in text)
ATrue\nTrue
BTrue\nFalse
CFalse\nTrue
DFalse\nFalse
Step-by-Step Solution
Solution:
  1. Step 1: Check if 'w' is in the string

    'w' is present in "hello world", so 'w' in text is True.
  2. Step 2: Check if 'z' is not in the string

    'z' is not present, so 'z' not in text is True.
  3. Final Answer:

    True\nTrue -> Option A
  4. Quick Check:

    Membership checks = B [OK]
Quick Trick: Check each character presence carefully [OK]
Common Mistakes:
MISTAKES
  • Mixing up 'in' and 'not in' results
  • Assuming missing char returns False for 'not in'
  • Ignoring case sensitivity

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes