Question: Write a Unified Modeling Language outline for the following Python program: Include the libraries imported and the structures used. import tkinter as tk from tkinter
Write a Unified Modeling Language outline for the following Python program: Include the libraries imported and the structures used.
import tkinter as tk
from tkinter import messagebox
import csv
def calculatehighlowpricesfilepath:
with openfilepath, r as file:
reader csvDictReaderfile
nextreader #skip the header row
highlowprices
for row in reader:
date rowDate
for stock, price in row.items:
if stock 'Date':
price floatprice
if stock not in highlowprices:
highlowpricesstockhigh: price, 'low': price
else:
highlowpricesstockhigh maxhighlowpricesstockhigh price
highlowpricesstocklow minhighlowpricesstocklow price
return highlowprices
def showprices:
filepath "Dow Jones Stocks February.csv
highlowprices calculatehighlowpricesfilepath
# Create a message to display the high and low prices for each stock message "Stock Prices for February:
for stock, prices in highlowprices.items:
message fstock High: priceshigh Low: priceslow
# Display the message in a dialog box
messagebox.showinfoStock Prices", message
# Create the main window
root tkTk
root.titleStock Price Analyzer"
# Create a button to trigger the calculation and display of stock prices button tkButtonroot text"Show Stock Prices", commandshowprices
button.packpady
# Start the main event loop
root.mainloop
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
