Bird
0
0

Consider this code snippet controlling fan speed based on layer number:

medium📝 Analysis Q13 of 15
3D Printing - Advanced Print Settings
Consider this code snippet controlling fan speed based on layer number:
if layer < 5:
    fan_speed = 0
elif layer <= 10:
    fan_speed = 128
else:
    fan_speed = 255
print(fan_speed)

What will be the output if layer = 7?
A128
B255
C0
DNone
Step-by-Step Solution
Solution:
  1. Step 1: Check layer value against conditions

    Layer 7 is not less than 5, but it is less than or equal to 10.
  2. Step 2: Determine fan speed for layer 7

    According to the code, fan_speed is set to 128 for layers between 5 and 10 inclusive.
  3. Final Answer:

    128 -> Option A
  4. Quick Check:

    Layer 7 fan speed = 128 [OK]
Quick Trick: Check conditions in order for correct fan speed [OK]
Common Mistakes:
  • Choosing 0 because layer is less than 10
  • Choosing 255 assuming max speed always
  • Ignoring elif condition

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More 3D Printing Quizzes