Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create these functions on python!! Def get_rate(start_hr, start_aln, day, is_hol

ID: 3794688 • Letter: C

Question

Create these functions on python!!

Def get_rate(start_hr, start_aln, day, is_hollday): This function is given the lime (in hours and minutes) when the group starts bowling, the day of the week, and a boolean value indicating whether it is a holiday. It needs to check and return the rate per person per name based on these parameters. The pricing is described in the table below. If the day is a holiday, then the holiday rates always apply Return value: how many dollars per person per game, as an int value.

Explanation / Answer


#============== get_rate =================================
def get_rate(start_hr,start_min,day,is_holiday):
   if((start_hr*60+start_min)<(18*60+30)):
       if(is_holiday):
           return 4
       elif(day<5):
           return 3
       elif(day==5):
           return 3
       else:
           return 4
   else:
       if(is_holiday):
           return 5
       elif(day<5):
           return 6
       elif(day==5):
           return 6
       else:
           return 6
#================= check_nite ===============================  
def check_nite(start_hr,start_min,day):
   if((start_hr*60+start_min)<(21*60+30)):
       return False
   else:
       if(day<6):
           return True
       else:
           return False
#================= get_fee ==================================
def get_fee(rate,num_games,num_people,day,is_nite,is_holiday):
   total = 0;
   if(is_holiday):
       return "your taotal is :"+str(rate*num_games*num_people)
   elif(is_nite):
      
       if(day<5):
           if((7*num_people)<(rate*num_games*num_people)):
               return "nite special! your total is ;"+str(7*num_people)
           else:
               return "your taotal is :"+str(rate*num_games*num_people)
       elif(day==5):
           if((12*num_people)<(rate*num_games*num_people)):
               return "nite special! your total is ;"+str(12*num_people)
           else:
               return "your taotal is :"+str(rate*num_games*num_people)
       else:
           return "your taotal is :"+str(rate*num_games*num_people)
   elif(day==7):
       if(num_people>3):
           return "Thrifti sunday! your taotal is :"+str(2*num_games*num_people)
       else:
           return "your taotal is :"+str(rate*num_games*num_people)
   else:
       return "your taotal is :"+str(rate*num_games*num_people)