Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part A num_data_points = 5 class_size = 100 def generate_random_percentage(): Generates a random percentage between 0 and 100. return random.random() *



You will display a line chart of a dynamic dataset. It is advised that you start with assignment 2 (Part A)

 Part A
num_data_points = 5
class_size = 100
def generate_random_percentage():
    """Generates a random percentage between 0 and 100."""
    return random.random() * 100
percentage_of_programming_students = [generate_random_percentage() for _ in range(num_data_points)]
number_of_students_in_class = [int(class_size * percentage / 100) for percentage in percentage_of_programming_students]
plt.plot(percentage_of_programming_students, number_of_students_in_class, 'r.')
plt.title('% of Students in Programming')
plt.xlabel('Percent of Programming Students')
plt.ylabel('Number of Students in Class')
plt.grid()
plt.show()

You will display a line chart of a dynamic dataset. It is advised that you start with assignment 2 (Part A) and add the capability to update the display you will add the capability of dynamically displaying a change dataset. You will build a GUI to display a set of values. You will display the values using both a line chart and a bar chart on the same app. Start of Go button is needed to initiate the app. Create a method that will be executed in a thread. This method will do the following in an infinite loop: Remove the first item in the list of values Add a new random value to the end of the list Call the method to display list on the canvas Sleep for a short while (0.5 of a second). In the initUI() method do the following at the end: You may remove the Entry widget. This is not used in this application. Create a thread and set the target to the method in step 1 Set the daemon property of the above thread to True. This will terminate the thread when the GUI closes. Start the thread. Modify the method that draws the rectangle and line to just draw lines.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Import the necessary libraries including Tkinter and random Create a GUI window with a Start button Define a function to generate random data points f... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Finite Mathematics and Its Applications

Authors: Larry J. Goldstein, David I. Schneider, Martha J. Siegel, Steven Hair

12th edition

978-0134768588, 9780134437767, 134768582, 134437764, 978-0134768632

More Books

Students also viewed these Programming questions

Question

Express the following ratios in its lowest terms.

Answered: 1 week ago