Introduction
Imagine needing a portable power source that can recharge many times and store a lot of energy safely. This is the challenge lithium-ion battery chemistry solves, powering everything from smartphones to electric cars.
Think of a lithium-ion battery like a busy ferry system. The lithium ions are passengers traveling between two islands (anode and cathode) across a water channel (electrolyte). Charging is like loading passengers onto the ferry to one island, and discharging is like sending them back to the other island to deliver energy.
┌─────────────┐ ┌─────────────┐
│ Cathode │◄──────│ Anode │
│ (Lithium │ │ (Lithium │
│ source) │──────►│ storage) │
└─────────────┘ └─────────────┘
▲ ▲
│ │
│ Electrolyte │
└────────────────────┘
Charging: ions move Anode ← Cathode
Discharging: ions move Anode → Cathodeions = ['Li+', 'Li+', 'Li+']
for i in range(len(ions)):
ions[i] = 'moved'
print(ions)
What will be the output?ions = ['Li+', 'Li+', 'Li+']
for ion in ions:
ion = 'moved'
print(ions)
What is the problem?states = ['Charging', 'Discharging', 'Idle']
percentages = [80, 50, 20]
# Create dict: state -> percentage
battery_status = {state: pct for state, pct in zip(states, percentages) if pct > 30}
print(battery_status)
What will be the output?Pass the test and this pattern moves unknown