Bird
0
0

Consider this script saved as calc.py:

medium📝 Predict Output Q5 of 15
Python - Basics and Execution Environment
Consider this script saved as calc.py:
result = 5 + 3
print(result)
What will be the output when run in script mode?
Aresult
BNo output
C5 + 3
D8
Step-by-Step Solution
Solution:
  1. Step 1: Calculate expression in script mode

    result is assigned the value 8 from 5 + 3.
  2. Step 2: Print the result variable

    print(result) outputs 8 to the console.
  3. Final Answer:

    8 -> Option D
  4. Quick Check:

    Script mode prints calculated result [OK]
Quick Trick: Script mode runs all code then prints output [OK]
Common Mistakes:
MISTAKES
  • Printing variable name instead of value
  • Expecting no output without print

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes