PP LAB
OPEN ENDED ASSIGNMENT
SIMPLE INTEREST AND COMPUND INTEREST CALCULATOR
Group-8
ISHITA MORE UIN2022742
SHRUTI KANGUNE UIN2022726
● PROBLEM STATEMENT:-
Create GUI in python for any application.
● ALGORITHM:-
1. Start the program.
2. import tkinter as tk.
3. Define a dictionary of countries and capitals.
4. Create a function to display the capital when a country is selected.
5. Create the main window.
6. Create a label.
7. Increase the font size for the dropdown menu options.
8. Create a button to display the capital.
9. Create a label to display the capital.
10. Create a main event loop.
[Link] the program.
● Code:-
import tkinter as tk
import tkinter as tk
from tkinter import ttk
def calculate_simple_interest():
principal = float(principal_entry.get())
rate = float(rate_entry.get())
time = float(time_entry.get())
simple_interest = (principal * rate * time) / 100
result_label.config(text=f"Simple Interest: {simple_interest:.2f}")
def calculate_compound_interest():
principal = float(principal_entry.get())
rate = float(rate_entry.get())
time = float(time_entry.get())
n = float(n_entry.get())
compound_interest = principal * (1 + (rate / (n * 100))) ** (n *
time) - principal
result_label.config(text=f"Compound Interest:
{compound_interest:.2f}")
app = [Link]()
[Link]("Interest Calculator")
frame = [Link](app)
[Link](row=0, column=0, padx=10, pady=10)
principal_label = [Link](frame, text="Principal:")
principal_label.grid(row=0, column=0, sticky='e')
principal_entry = [Link](frame)
principal_entry.grid(row=0, column=1)
rate_label = [Link](frame, text="Rate (%):")
rate_label.grid(row=1, column=0, sticky='e')
rate_entry = [Link](frame)
rate_entry.grid(row=1, column=1)
time_label = [Link](frame, text="Time (years):")
time_label.grid(row=2, column=0, sticky='e')
time_entry = [Link](frame)
time_entry.grid(row=2, column=1)
n_label = [Link](frame, text="Compounding frequency (n):")
n_label.grid(row=3, column=0, sticky='e')
n_entry = [Link](frame)
n_entry.grid(row=3, column=1)
simple_interest_button = [Link](frame, text="Calculate Simple
Interest", command=calculate_simple_interest)
simple_interest_button.grid(row=4, column=0, columnspan=2)
compound_interest_button = [Link](frame, text="Calculate Compound
Interest", command=calculate_compound_interest)
compound_interest_button.grid(row=5, column=0, columnspan=2)
result_label = [Link](frame, text="")
result_label.grid(row=6, column=0, columnspan=2)
[Link]()
OUTPUT