Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set the surface roughness value to 1.6 micrometers.
CNC Programming
surface_roughness = [1] # Ra value in micrometers
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a value too large like 16 which is not typical for Ra.
Using a value too small like 0.16 without context.
✗ Incorrect
The standard Ra value for a smooth finish is often 1.6 micrometers.
2fill in blank
mediumComplete the code to calculate the average surface roughness from a list of Ra measurements.
CNC Programming
average_ra = sum(ra_values) / [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Dividing by max or min values instead of count.
Using an element instead of the length of the list.
✗ Incorrect
To find the average, divide the sum by the number of measurements using len().
3fill in blank
hardFix the error in the code to compare if the Ra value is less than the maximum allowed roughness.
CNC Programming
if ra_value [1] max_roughness: print('Surface finish is acceptable')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' which checks if roughness is greater, meaning worse finish.
Using '==' which only checks equality.
✗ Incorrect
We check if the Ra value is less than the maximum allowed roughness to accept the surface.
4fill in blank
hardFill both blanks to create a dictionary of parts with their Ra values filtered by a maximum roughness.
CNC Programming
filtered_parts = {part: ra for part, ra in parts_ra.items() if ra [1] [2] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' instead of '<' which would filter the wrong parts.
Using min_roughness instead of max_roughness.
✗ Incorrect
We filter parts where Ra is less than the maximum roughness allowed.
5fill in blank
hardFill all three blanks to create a dictionary comprehension that converts Ra values from micrometers to nanometers for parts with Ra less than max_roughness.
CNC Programming
converted_ra = { [1]: ra * [2] for [3], ra in parts_ra.items() if ra < max_roughness } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ra' as key instead of 'part'.
Multiplying by wrong factor or variable.
Swapping variable names in the loop.
✗ Incorrect
We use 'part' as key, multiply Ra by 1000 to convert micrometers to nanometers, and iterate with 'part, ra'.