Challenge - 5 Problems
Barometer Altitude Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate1:30remaining
Calculate altitude from pressure reading
Given the barometric pressure reading in Pascals, what is the altitude in meters calculated by the formula?
Altitude = 44330 * (1 - (pressure / 101325)^(1/5.255))
What is the output of this code snippet?
Altitude = 44330 * (1 - (pressure / 101325)^(1/5.255))
What is the output of this code snippet?
Drone Programming
pressure = 90000 altitude = 44330 * (1 - (pressure / 101325) ** (1/5.255)) print(round(altitude))
Attempts:
2 left
💡 Hint
Use the formula carefully and round the result to the nearest integer.
✗ Incorrect
The formula calculates altitude based on pressure ratio raised to the power 1/5.255. Plugging 90000 Pa gives approximately 1115 meters.
🧠 Conceptual
intermediate1:30remaining
Understanding barometer altitude calculation assumptions
Which assumption is NOT true when using a barometer to calculate altitude from pressure?
Attempts:
2 left
💡 Hint
Think about what environmental factors affect air pressure.
✗ Incorrect
Humidity affects air density and pressure readings, so assuming it has no effect is incorrect.
🔧 Debug
advanced2:00remaining
Fix the altitude calculation code with wrong operator
This code is intended to calculate altitude from pressure but produces a wrong result. What is the error?
Drone Programming
pressure = 85000 altitude = 44330 * (1 - pressure / 101325) ** (1/5.255) print(round(altitude))
Attempts:
2 left
💡 Hint
Check operator precedence and grouping in the formula.
✗ Incorrect
Without parentheses around (pressure / 101325), the exponent applies only to the division, not the entire term inside the parentheses, causing wrong altitude.
📝 Syntax
advanced1:30remaining
Identify the syntax error in altitude calculation snippet
Which option contains a syntax error that prevents the altitude calculation code from running?
Drone Programming
pressure = 95000 altitude = 44330 * (1 - (pressure / 101325) ** (1/5.255)) print(round(altitude))
Attempts:
2 left
💡 Hint
Look carefully at operator precedence and parentheses.
✗ Incorrect
Option A lacks parentheses around the exponent, so ** has higher precedence than /, causing a wrong calculation (not a syntax error).
🚀 Application
expert2:30remaining
Calculate altitude difference from two pressure readings
You have two pressure readings from a drone's barometer at two different points:
Pressure1 = 101325 Pa (sea level)
Pressure2 = 90000 Pa (higher altitude)
Using the formula:
Altitude = 44330 * (1 - (pressure / 101325)^(1/5.255))
What is the altitude difference between the two points?
Pressure1 = 101325 Pa (sea level)
Pressure2 = 90000 Pa (higher altitude)
Using the formula:
Altitude = 44330 * (1 - (pressure / 101325)^(1/5.255))
What is the altitude difference between the two points?
Attempts:
2 left
💡 Hint
Calculate altitude for each pressure then subtract.
✗ Incorrect
Altitude at sea level is 0. Altitude at 90000 Pa is about 1115 meters. Difference is 1115 meters.