Bird
0
0

What will be the output of this code?

medium📝 Predict Output Q5 of 15
Python - Variables and Dynamic Typing
What will be the output of this code?
_value = 10
value = 5
print(_value - value)
A5
B-5
C15
DSyntaxError
Step-by-Step Solution
Solution:
  1. Step 1: Identify variable values

    _value is 10 and value is 5, both valid variable names.
  2. Step 2: Calculate the expression

    _value - value equals 10 - 5 which is 5.
  3. Final Answer:

    5 -> Option A
  4. Quick Check:

    Variable names with underscore are valid and distinct [OK]
Quick Trick: Underscore prefix is allowed and creates distinct variables [OK]
Common Mistakes:
MISTAKES
  • Confusing variables with and without underscore
  • Expecting syntax error due to underscore
  • Mixing variable values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes