📖 Scenario: You are learning how electric vehicles (EVs) use energy management to travel farther on a single charge. Understanding this helps drivers get the most distance before needing to recharge.
🎯 Goal: Build a simple explanation using data and logic to show how managing energy use in an EV can increase its driving range.
📋 What You'll Learn
Create a dictionary called energy_use with exact keys and values for different driving modes
Add a variable called max_battery representing the battery capacity in kWh
Calculate the range for each driving mode using a dictionary comprehension called range_by_mode
Add a final statement that identifies the driving mode with the maximum range
💡 Why This Matters
🌍 Real World
Electric vehicle drivers and manufacturers use energy management data to optimize driving modes and extend travel distance on a single charge.
💼 Career
Understanding energy consumption and range calculations is important for EV engineers, product designers, and sustainability analysts.
Progress0 / 4 steps
1
DATA SETUP: Define energy use per km for driving modes
Create a dictionary called energy_use with these exact entries: 'eco': 0.12, 'normal': 0.18, 'sport': 0.25. These numbers represent energy used in kWh per kilometer for each mode.
EV Technology
Hint
Use curly braces to create a dictionary with keys 'eco', 'normal', and 'sport' and their respective energy values.
2
CONFIGURATION: Set the maximum battery capacity
Add a variable called max_battery and set it to 50. This represents the battery capacity in kilowatt-hours (kWh).
EV Technology
Hint
Just assign the number 50 to the variable max_battery.
3
CORE LOGIC: Calculate range for each driving mode
Create a dictionary comprehension called range_by_mode that calculates the range in kilometers for each mode by dividing max_battery by the energy use per km from energy_use. Use mode and energy as the iteration variables.
EV Technology
Hint
Use a dictionary comprehension with for mode, energy in energy_use.items() and calculate max_battery / energy for each.
4
COMPLETION: Identify the driving mode with the maximum range
Add a variable called best_mode that stores the key from range_by_mode with the highest range value. Use the max() function with key=range_by_mode.get.
EV Technology
Hint
Use max() on range_by_mode with key=range_by_mode.get to find the mode with the highest range.
Practice
(1/5)
1. Why does managing energy well help an electric vehicle (EV) travel farther on a single charge?
easy
A. Because it increases the battery size automatically
B. Because it reduces unnecessary energy use, saving battery power
C. Because it makes the car heavier, improving stability
D. Because it changes the color of the car to reflect sunlight
Solution
Step 1: Understand energy use in EVs
Electric vehicles use battery power to move and run accessories. Managing energy means using less power for the same distance.
Step 2: Connect energy management to range
By reducing unnecessary energy use, the battery lasts longer before needing a recharge, so the car can travel farther.
Final Answer:
Because it reduces unnecessary energy use, saving battery power -> Option B
Quick Check:
Less energy use = longer travel distance [OK]
Hint: Saving energy means using less battery power [OK]
Common Mistakes:
Thinking battery size changes automatically
Confusing weight with energy efficiency
Believing color affects battery range
2. Which of the following is a correct example of energy management technique in EVs?
easy
A. Driving smoothly without sudden acceleration
B. Turning on all lights and accessories at once
C. Using the air conditioner at maximum power always
D. Ignoring regenerative braking and coasting
Solution
Step 1: Identify energy-saving driving habits
Smooth driving avoids sudden power bursts, which use more battery energy.
Step 2: Compare options for energy use
Turning on many accessories or ignoring regenerative braking wastes energy, while smooth driving saves it.
Final Answer:
Driving smoothly without sudden acceleration -> Option A
Quick Check:
Smooth driving saves energy [OK]
Hint: Smooth driving saves battery power [OK]
Common Mistakes:
Assuming all accessories use no energy
Thinking maximum air conditioning saves energy
Ignoring benefits of regenerative braking
3. Consider this code snippet simulating energy use in an EV:
energy = 100
speed = 60
if speed > 50:
energy -= 20
else:
energy -= 10
print(energy)
What will be the output?
medium
A. 90
B. 20
C. 100
D. 80
Solution
Step 1: Check the speed condition
Speed is 60, which is greater than 50, so the first condition is true.
Step 2: Calculate energy after deduction
Energy starts at 100, then 20 is subtracted because speed > 50, so energy becomes 80.
Final Answer:
80 -> Option D
Quick Check:
Speed > 50 means energy = 100 - 20 = 80 [OK]
Hint: Check condition and subtract correct amount [OK]
Common Mistakes:
Using else branch incorrectly
Forgetting to subtract energy
Confusing comparison operators
4. This code tries to simulate energy saving but has a mistake:
energy = 100
speed = 40
if speed > 50:
energy -= 20
else:
energy -= 10
print(energy)
What is the error and how to fix it?
medium
A. Indentation error; indent lines inside if and else blocks
B. Wrong comparison operator; use < instead of >
C. Missing print statement; add print(energy) inside if
D. Variable name error; use Energy instead of energy
Solution
Step 1: Identify Python syntax rules
Python requires indentation inside if and else blocks to define code scope.
Step 2: Check the code indentation
The lines subtracting energy are not indented, causing a syntax error.
Step 3: Fix by indenting those lines
Indent the lines under if and else to fix the error.
Final Answer:
Indentation error; indent lines inside if and else blocks -> Option A
Quick Check:
Indent blocks properly to avoid syntax errors [OK]
Hint: Indent code inside if/else blocks [OK]
Common Mistakes:
Ignoring indentation rules
Changing comparison operator unnecessarily
Misplacing print statement
5. An EV driver wants to maximize range on a long trip. Which combined strategy will best help save energy?
hard
A. Drive smoothly but ignore regenerative braking and use maximum air conditioning
B. Drive fast, turn off regenerative braking, and use all accessories
C. Drive smoothly, use regenerative braking, and limit air conditioning use
D. Drive fast, use regenerative braking, and keep all lights on
Solution
Step 1: Analyze driving style impact
Smooth driving reduces sudden energy spikes, saving battery power.
Step 2: Consider regenerative braking and accessory use
Regenerative braking recovers energy when slowing down; limiting air conditioning reduces extra battery drain.
Step 3: Combine all to maximize range
Using all three together saves the most energy, extending the EV's travel distance.
Final Answer:
Drive smoothly, use regenerative braking, and limit air conditioning use -> Option C
Quick Check:
Combine smooth driving + regen braking + less AC = max range [OK]
Hint: Combine smooth driving, regen braking, and less AC [OK]
Common Mistakes:
Ignoring regenerative braking benefits
Using maximum accessories wastes energy
Driving fast reduces battery range
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.