0
0
3D Printingknowledge~10 mins

Cooling fan control in 3D Printing - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to turn the cooling fan ON when the temperature exceeds 50°C.

3D Printing
if temperature [1] 50:
    fan_state = 'ON'
Drag options to blanks, or click blank then click option'
A>
B<
C==
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' causes the fan to turn ON at low temperatures.
Using '==' only turns the fan ON at exactly 50°C.
2fill in blank
medium

Complete the code to set the fan speed to 100% when the temperature is above 60°C.

3D Printing
fan_speed = 100 if temperature [1] 60 else 0
Drag options to blanks, or click blank then click option'
A<
B>
C==
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<=' sets fan speed to 100% at low temperatures.
Using '==' only sets fan speed at exactly 60°C.
3fill in blank
hard

Fix the error in the code to correctly turn the fan OFF when temperature is below 40°C.

3D Printing
if temperature [1] 40:
    fan_state = 'OFF'
Drag options to blanks, or click blank then click option'
A<
B>
C>=
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' turns fan OFF at high temperatures.
Using '>=' or '==' does not cover all temperatures below 40°C.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that sets fan speed to 100 if temperature is above 55, else 0.

3D Printing
fan_speeds = {room: 100 if temp [1] 55 else [2] for room, temp in temps.items()}
Drag options to blanks, or click blank then click option'
A>
B0
C50
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' reverses the logic.
Setting else value to 50 instead of 0 causes incorrect fan speed.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that sets fan speed to 100 if temperature is above 60, else 50 if above 40, else 0.

3D Printing
fan_speeds = {room: 100 if temp [1] 60 else 50 if temp [2] 40 else [3] for room, temp in temps.items()}
Drag options to blanks, or click blank then click option'
A>
C0
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' reverses conditions.
Setting else value to 50 instead of 0 causes wrong fan speed.