Hint

🧠 Not sure where to start?

Start by importing the necessary libraries for the GUI and plotting:

import matplotlib.pyplot as plt
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel, QLineEdit, QPushButton
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure

Now think: how can you let users input data and show a chart? You’ll want a text input, a button, and a canvas for the chart:

self.input_box = QLineEdit()
self.plot_btn = QPushButton("Generate Histogram")
self.canvas = FigureCanvas(Figure())

When the button is clicked, parse the input with something like:

ages = [int(age.strip()) for age in text.split(",") if age.strip().isdigit()]

Then draw the histogram on the canvas using ax.hist(...) with bins like range(0, 101, 10).