Python Prompts Free Prompt

Python Script to Generate a Histogram from Data

Create a Python script that reads numerical data from a file and generates a histogram
☆ Save
Prompt
You are a Python developer. Write a script that reads a list of numbers from a text file (one per line) and generates a histogram using matplotlib. The script must: 1) Accept file path, 2) Compute histogram bins, 3) Display the plot, 4) Save as image, 5) Provide options for number of bins, 6) Add labels and title, 7) Handle missing data. 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.