Python Prompts Free Prompt

Python Script to Monitor Battery Health

Write a Python script that reports battery health on laptops
☆ Save
Prompt
You are a Python developer. Write a script that uses psutil to get battery information and also read design capacity vs full charge capacity (on Linux from /sys/class/power_supply/BAT0/). The script must: 1) Get current capacity, design capacity, 2) Calculate health percentage, 3) Output, 4) Log to file, 5) Alert if health low, 6) Handle missing battery, 7) Add comments.

How to use this prompt

1
Click Copy Prompt above to copy to your clipboard.
2
Open ChatGPT, Claude, Gemini, or any AI assistant and paste the prompt.
3
Replace any [PLACEHOLDER] values with your specific details.
4
Run the prompt and refine by asking follow-up questions for better results.