Please write code in python
Answer
Here is the completed code for this problem. Commentsare included, go through it, learn how things work and let me knowif you have any doubts or if you need anything to change. If youare satisfied with the solution, please rate the answer.Thanks
#code
from tkinter import *
from tkinter importmessagebox
#declaring call rates for day and night
day_rate=0.12
night_rate=0.05
#method to calculate and display charges
def calculate():
cost=0
#checking if it is day time or nighttime
ifdayNight.get()==1:
#day rate
cost=day_rate
else:
#night rate
cost=night_rate
mins=0
#parsing call duration
try:
mins=float(minutes.get())
except:
#error
messagebox.showinfo(‘Error’,‘Invalidminutes’)
return
#finding and displaying total
total=cost*mins
messagebox.showinfo(‘TotalCharges’, ‘Your total