📖 Scenario: You are programming a simple drone simulation. The drone's motors spin propellers to create lift. You want to calculate the total thrust produced by the drone's motors based on their speeds and propeller characteristics.
🎯 Goal: Build a program that stores motor speeds and propeller thrust factors, calculates the thrust for each motor, sums the total thrust, and displays the result.
📋 What You'll Learn
Create a dictionary with motor names and their speeds in RPM
Create a dictionary with motor names and their propeller thrust factors
Calculate thrust for each motor by multiplying speed and thrust factor
Sum all motor thrusts to get total thrust
Print the total thrust
💡 Why This Matters
🌍 Real World
Drone engineers use motor speeds and propeller characteristics to estimate how much lift a drone can produce, which helps in designing stable and efficient drones.
💼 Career
Understanding motor and propeller physics is important for drone software developers, robotics engineers, and anyone working on flight control systems.
Progress0 / 4 steps
1
Set up motor speeds
Create a dictionary called motor_speeds with these exact entries: 'motor1': 1200, 'motor2': 1300, 'motor3': 1250, 'motor4': 1280
Drone Programming
Hint
Use curly braces to create a dictionary. Each motor name is a key, and its speed in RPM is the value.
2
Set up propeller thrust factors
Create a dictionary called thrust_factors with these exact entries: 'motor1': 0.05, 'motor2': 0.045, 'motor3': 0.048, 'motor4': 0.047
Drone Programming
Hint
Use a dictionary to store the thrust factor for each motor. These numbers represent how much thrust each RPM produces.
3
Calculate total thrust
Create a variable called total_thrust and set it to 0. Then use a for loop with variables motor and speed to iterate over motor_speeds.items(). Inside the loop, multiply speed by the corresponding thrust factor from thrust_factors[motor] and add the result to total_thrust.
Drone Programming
Hint
Start with total_thrust = 0. Use a for loop to go through each motor and speed. Multiply speed by thrust factor and add to total_thrust.
4
Display total thrust
Write a print statement to display the text Total thrust: followed by the value of total_thrust.
Drone Programming
Hint
Use an f-string in the print statement to show the text and the total_thrust value together.
Practice
(1/5)
1. Which factor directly increases the thrust generated by a drone's propeller?
easy
A. Lowering the drone's weight
B. Increasing the motor speed (rpm)
C. Reducing the battery voltage
D. Decreasing the propeller size
Solution
Step 1: Understand thrust formula basics
Thrust depends on the square of the motor speed (rpm) and the propeller area.
Step 2: Identify which factor increases thrust
Increasing rpm increases thrust because thrust ∝ rpm² x propeller area.
Final Answer:
Increasing the motor speed (rpm) -> Option B
Quick Check:
Thrust ∝ rpm² [OK]
Hint: Thrust grows with rpm squared, so speed up motor [OK]
Common Mistakes:
Thinking smaller propellers increase thrust
Confusing power with thrust
Ignoring rpm's squared effect
2. Which of the following is the correct Python syntax to calculate power given rpm and propeller_area variables?
easy
A. power = rpm ** 2 + propeller_area
B. power = rpm * 3 * propeller_area
C. power = rpm ^ 3 * propeller_area
D. power = rpm ** 3 * propeller_area
Solution
Step 1: Recall Python exponent syntax
Python uses ** for exponentiation, so rpm cubed is rpm ** 3.
Step 2: Match formula for power
Power depends on rpm cubed times propeller area, so multiply rpm ** 3 by propeller_area.
Final Answer:
power = rpm ** 3 * propeller_area -> Option D
Quick Check:
Use ** for power, not ^ or *3 [OK]
Hint: Use ** for powers in Python, not ^ or * number [OK]
Common Mistakes:
Using ^ instead of ** for exponent
Multiplying rpm by 3 instead of cubing
Adding instead of multiplying
3. What is the output of this Python code snippet?
In Python, ^ is bitwise XOR, not exponentiation. Use ** for powers.
Step 2: Understand impact on calculation
Using ^ causes wrong calculation or unexpected result, not power of rpm.
Final Answer:
Using ^ instead of ** for exponentiation -> Option C
Quick Check:
Use ** for powers, not ^ [OK]
Hint: Remember ** means power, ^ is bitwise XOR [OK]
Common Mistakes:
Confusing ^ with **
Assuming parentheses fix ^ operator
Ignoring operator precedence
5. You want to program a drone to maintain constant thrust while reducing motor speed to save battery. If you reduce rpm by 20%, how should you adjust the propeller area to keep thrust constant? (Thrust ∝ rpm² x propeller_area)
hard
A. Increase propeller area by 56.25%
B. Increase propeller area by 25%
C. Decrease propeller area by 20%
D. Keep propeller area the same
Solution
Step 1: Calculate new rpm ratio squared
Reducing rpm by 20% means new rpm = 0.8 x original rpm. Squared: 0.8² = 0.64.
Step 2: Find required propeller area increase
To keep thrust constant, propeller_area x 0.64 = original propeller_area. So, new propeller_area = 1 / 0.64 ≈ 1.5625 times original, or 56.25% increase.