Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to display a numeric input field on the operator screen.
PLC Programming
DisplayNumericInput([1], "Enter Value:")
Attempts:
3 left
💡 Hint
Common Mistakes
Using the input type instead of the panel identifier.
Passing the screen name instead of the panel.
✗ Incorrect
The function DisplayNumericInput requires the operator panel identifier as the first argument to show the input field.
2fill in blank
mediumComplete the code to read the operator's input from the screen.
PLC Programming
userValue = ReadInput([1])Attempts:
3 left
💡 Hint
Common Mistakes
Trying to read from the entire screen or panel instead of the input field.
Using the panel name instead of the input field.
✗ Incorrect
ReadInput needs the input field identifier to get the value entered by the operator.
3fill in blank
hardFix the error in the code to correctly validate the operator input is within range.
PLC Programming
if [1] >= 0 and userValue <= 100: AcceptInput()
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name that was never defined.
Mixing variable names from other parts of the code.
✗ Incorrect
The variable holding the operator input is userValue, so it must be used in the condition.
4fill in blank
hardFill both blanks to create a dictionary of input fields and their default values.
PLC Programming
inputDefaults = { [1]: 0, [2]: 10 }Attempts:
3 left
💡 Hint
Common Mistakes
Using the same input field twice.
Using invalid or unrelated field names.
✗ Incorrect
The dictionary keys are input field names. SpeedInput and PressureInput are valid field names here.
5fill in blank
hardFill all three blanks to filter inputs with values greater than zero.
PLC Programming
validInputs = { [1]: [2] for [1] in [3] if [2] > 0 }Attempts:
3 left
💡 Hint
Common Mistakes
Using the same variable name for different roles.
Confusing the dictionary and its keys or values.
✗ Incorrect
The dictionary comprehension iterates over inputs, using key and value to filter values greater than zero.
