Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In python Goal: GUIs and Canvas widget Suppose you know that in a class of 180 s

ID: 3716401 • Letter: I

Question

In python Goal: GUIs and Canvas widget Suppose you know that in a class of 180 students, 35 students received an A, 55 students earned a B, 78 students earned a C, 7 students earned a D and 5 students earned an F. Create a GUI that uses the Python Canvas Widget to create a Pie Chart showing the proportions of each grade using appropriately sized wedges that represent the amount of students earning each grade. Each pie slice should be a different color. Next used labels that show the colors used and the corresponding letter grades. Hint: the appropriate extent of the angle can be calculated by multiplying the number of students by 2. M In python Goal: GUIs and Canvas widget Suppose you know that in a class of 180 students, 35 students received an A, 55 students earned a B, 78 students earned a C, 7 students earned a D and 5 students earned an F. Create a GUI that uses the Python Canvas Widget to create a Pie Chart showing the proportions of each grade using appropriately sized wedges that represent the amount of students earning each grade. Each pie slice should be a different color. Next used labels that show the colors used and the corresponding letter grades. Hint: the appropriate extent of the angle can be calculated by multiplying the number of students by 2. M In python Goal: GUIs and Canvas widget Suppose you know that in a class of 180 students, 35 students received an A, 55 students earned a B, 78 students earned a C, 7 students earned a D and 5 students earned an F. Create a GUI that uses the Python Canvas Widget to create a Pie Chart showing the proportions of each grade using appropriately sized wedges that represent the amount of students earning each grade. Each pie slice should be a different color. Next used labels that show the colors used and the corresponding letter grades. Hint: the appropriate extent of the angle can be calculated by multiplying the number of students by 2. M

Explanation / Answer

Code:

import matplotlib.pyplot as plt
import numpy

# Data to plot
labels = 'A', 'B', 'C', 'D', 'F'
sizes = [35, 55, 78, 7, 5]
colors = ['gold', 'yellowgreen', 'lightcoral', 'lightskyblue', 'pink']

def absolute_value(val):
    a = numpy.round(val/100.*180, 0)
    return a


plt.pie(sizes, labels=labels, colors=colors, autopct=absolute_value, shadow=True)

plt.axis('equal')
plt.show()

# plot 2
plt.pie(sizes, labels=labels, colors=colors,autopct='%1.1f%%', shadow=True, startangle=140)

plt.axis('equal')
plt.show()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote