Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define the motor speed variable.
Simulink
motor_speed = [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names instead of initial numeric value.
Starting motor speed at 1 instead of 0.
✗ Incorrect
We start motor speed at 0 before simulation.
2fill in blank
mediumComplete the code to simulate motor torque calculation.
Simulink
torque = motor_current [1] motor_constant Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using addition or subtraction instead of multiplication.
Dividing instead of multiplying.
✗ Incorrect
Torque is calculated by multiplying current by motor constant.
3fill in blank
hardFix the error in the simulation step size assignment.
Simulink
step_size = [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using zero or negative values for step size.
Using string instead of numeric value.
✗ Incorrect
Step size must be a positive number, not zero or negative or string.
4fill in blank
hardFill both blanks to create a dictionary of motor parameters with speed and torque.
Simulink
motor_params = {'speed': [1], 'torque': [2] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names that do not exist.
Swapping speed and torque variables.
✗ Incorrect
The dictionary keys 'speed' and 'torque' map to motor_speed and torque variables.
5fill in blank
hardFill all three blanks to filter motor speeds above threshold and create a result dictionary.
Simulink
result = {k: v for k, v in motor_params.items() if v [1] [2]
filtered_speed = result.get('[3]', 0) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong comparison operator.
Using wrong threshold value.
Getting wrong key from dictionary.
✗ Incorrect
We filter motor parameters where value is greater than 10 and get the speed value.