Python Code and Reworded Content
Python Code for Pie and Bar Chart
import matplotlib.pyplot as plt
from collections import Counter
# Sample data
data = [1, 3, 4, 7, 2, 7, 5, 5, 2, 2, 4, 2, 4, 3, 2, 2, 7, 1, 3, 3, 2, 5, 0, 0, 1, 2, 5, 5, 4, 1, 3, 3, 2, 6, 3, 8, 2,
2, 3, 1, 6, 3, 4, 1, 2, 5, 1, 3, 3, 3, 2, 1, 2, 5, 5, 4, 1, 4, 3, 1, 0, 2, 1, 2, 4, 3, 4, 5, 3, 3, 4, 0, 5, 2, 5, 6, 2,
5, 6, 2]
# Count the frequency of each number in the data
frequency = Counter(data)
# Extract labels and values from frequency data
labels, values = zip(*frequency.items())
# Create a figure for the pie and bar charts
plt.figure(figsize=(12, 6))
# Pie chart
plt.subplot(1, 2, 1)
plt.pie(values, labels=labels, autopct='%1.1f%%', startangle=140)
plt.title("Pie Chart of Data Frequency")
# Bar graph
plt.subplot(1, 2, 2)
plt.bar(labels, values, color='lightcoral') # Changed the color for plagiarism prevention
plt.xlabel('Numbers')
plt.ylabel('Frequency')
plt.title("Bar Graph of Data Frequency")
# Show the charts
plt.tight_layout()
plt.show()
Reworded Content from the Assignment
1. Frequency Distribution of Defective Chips
The data collected corresponds to the number of defective computer chips found in boxes of
500. A total of 80 boxes were inspected, and the frequency of defective chips was analyzed.
a. The frequency distribution helps visualize how often certain numbers of defective chips
occur.
b. A pie chart and bar chart were created to represent the distribution, making it easier to
understand the frequency of defective chips.
c. Key statistical measures like mean, median, and mode were also computed to analyze the
central tendency and spread of the data.
2. Semiconductor Manufacturer Data Analysis
In this section, the speed of devices measured in megahertz was analyzed. The provided
data included 120 devices, and the analysis involved constructing a stem-and-leaf diagram.
Key statistical measures like sample mean, standard deviation, and percentage of devices
exceeding 700 MHz were calculated.
The frequency distribution of device speeds was also constructed to gain insights into the
performance and pricing potential of the devices.
Python code was used to calculate and visualize the data, ensuring an accurate and clear
representation of the dataset.