import tkinter as tk
class Programm(tk.Tk):
def __init__(self):
super().__init__()
self.title("Сумма квадратов")
self.label1=tk.Label(self,text="Введите кол-во дней:").grid(row=0,column=0)
self.input=tk.Entry(self)
self.input.grid(row=0,column=1)
self.button= tk.Button(self, text="Посчитать", command=self.clicked,width=40).grid(row=1,columnspan=2)
self.label2=tk.Label(self, text="")
self.label2.grid(row=2,columnspan=2)
def clicked(self):
if self.input.get()=="20":
txt="22000"
elif int(self.input.get())<10:
txt=str(20000*0.4)
else: txt="20000"
self.label2["text"]=txt
if __name__ == "__main__":
app=Programm()
app.mainloop()
# сложный процент
bank = 7
state = 19.5
years = summ = 0
have = float(input())
while summ <= 1000000:
years += 1
summ = have * (1 + bank / 100 * (1 - state / 100)) ** years
print(years)
# простой процент
from math import ceil
bank = 7
state = 19.5
have = float(input())
per = have * bank / 100 * (1 - state / 100)
years = (1000000 - have) / per
print(ceil(years))
Объяснение: