Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set the tolerance value for the CNC program.
CNC Programming
tolerance = [1] # Set tolerance in millimeters
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a large number like 10 or 100 as tolerance.
Using a negative number for tolerance.
✗ Incorrect
Tolerance values are usually small positive numbers representing millimeters. 0.01 mm is a common tight tolerance.
2fill in blank
mediumComplete the code to check if the measured dimension is within tolerance.
CNC Programming
if abs(measured_value - target_value) [1] tolerance: print('Within tolerance') else: print('Out of tolerance')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' instead of '<=' which reverses the logic.
Using '==' which is too strict for tolerance.
✗ Incorrect
The absolute difference must be less than or equal to the tolerance to be acceptable.
3fill in blank
hardFix the error in the code that calculates the tolerance zone.
CNC Programming
upper_limit = target_value [1] tolerance
lower_limit = target_value - tolerance Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' for upper_limit which lowers the limit incorrectly.
Using '*' or '/' which are not correct for adding tolerance.
✗ Incorrect
Upper limit adds tolerance, lower limit subtracts tolerance. The blank is for upper_limit only, so it should add tolerance.
4fill in blank
hardFill both blanks to calculate the tolerance zone limits correctly.
CNC Programming
upper_limit = target_value [1] tolerance lower_limit = target_value [2] tolerance
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same operator for both limits.
Using multiplication or division instead of addition or subtraction.
✗ Incorrect
Upper limit adds tolerance, lower limit subtracts tolerance to define the acceptable range.
5fill in blank
hardFill all three blanks to create a dictionary of parts within tolerance.
CNC Programming
within_tolerance = {part_id: measurement for part_id, measurement in measurements.items() if abs(measurement [1] target_value) [2] [3] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' instead of '-' inside abs().
Using '>' instead of '<=' for comparison.
Using a number instead of the tolerance variable.
✗ Incorrect
We subtract target_value from measurement, check if absolute difference is less than or equal to tolerance.