Bird
0
0

What will this code print on a Raspberry Pi dashboard?

medium📝 Predict Output Q5 of 15
Raspberry Pi - Web Server and API
What will this code print on a Raspberry Pi dashboard?
sensor_values = [10, 20, 30]
for value in sensor_values:
    if value > 15:
        print(value)
A10 20 30
B20 30
C10
DNo output
Step-by-Step Solution
Solution:
  1. Step 1: Check condition inside loop

    Only values greater than 15 are printed.
  2. Step 2: Identify which values satisfy condition

    20 and 30 are greater than 15; 10 is not.
  3. Final Answer:

    20 30 -> Option B
  4. Quick Check:

    Condition filter output [OK]
Quick Trick: Print only values passing the if condition inside loop [OK]
Common Mistakes:
MISTAKES
  • Printing all values ignoring condition
  • Printing only first value
  • Expecting no output when condition matches some values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes