Challenge - 5 Problems
Surface Finish Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Calculate average surface roughness (Ra) from measurements
Given a list of surface roughness measurements in micrometers, what is the average Ra value calculated by the script?
CNC Programming
measurements = [0.8, 1.2, 0.9, 1.1, 1.0] avg_ra = sum(measurements) / len(measurements) print(f"Average Ra: {avg_ra:.2f} µm")
Attempts:
2 left
💡 Hint
Add all measurements and divide by the number of measurements.
✗ Incorrect
The average Ra is the sum of all measurements divided by their count: (0.8+1.2+0.9+1.1+1.0)/5 = 1.0 µm.
📝 Syntax
intermediate2:00remaining
Identify the correct Python syntax to filter Ra values below 1.0 µm
Which option correctly filters a list of Ra values to include only those less than 1.0 µm?
CNC Programming
ra_values = [0.5, 1.2, 0.9, 1.1, 0.8]
Attempts:
2 left
💡 Hint
List comprehensions use 'if' after the 'for' clause.
✗ Incorrect
Option A uses correct Python list comprehension syntax to filter values less than 1.0.
🔧 Debug
advanced2:00remaining
Find the error in this Ra calculation script
What error does this Python script raise when calculating average Ra?
CNC Programming
ra_values = [0.7, 0.9, 1.1] avg_ra = sum(ra_values) / len(ra_values) print(f"Average Ra: {avg_ra:.2f} µm")
Attempts:
2 left
💡 Hint
Check for missing parentheses in function calls.
✗ Incorrect
The script uses 'avg_ra' in print but defines 'avg_ra' correctly; however, the original code was missing a closing parenthesis causing SyntaxError. The fixed code here has a NameError because 'avg_ra' is not defined due to the missing parenthesis in the original code.
🚀 Application
advanced2:00remaining
Automate Ra value classification
Which script correctly classifies Ra values into 'Smooth' if below 1.0 µm and 'Rough' otherwise, printing the results?
CNC Programming
ra_values = [0.6, 1.3, 0.9, 1.1]
Attempts:
2 left
💡 Hint
Values below 1.0 are 'Smooth', others 'Rough'.
✗ Incorrect
Option C correctly checks if ra < 1.0 and prints 'Smooth', else 'Rough'.
🧠 Conceptual
expert2:00remaining
Understanding Ra value impact on CNC machining
Which statement best describes the effect of a lower Ra value on CNC machined surface quality?
Attempts:
2 left
💡 Hint
Ra measures surface roughness; lower means smoother.
✗ Incorrect
Ra is the average roughness; lower values mean smoother surfaces, which usually improve quality and reduce friction.