Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Call to Home solution in Speedy category for Call to Home by JimmyCarlos
import math
def total_cost(calls):
totalCost = 0
currentDay,currentDayMinutes = None, 0
for call in calls:
day,time,seconds = call.split(" ")
minutes = math.ceil(int(seconds)/60)
if day == currentDay:
currentDayMinutes += minutes
else:
totalCost += convert_minutes_to_cost(currentDayMinutes)
currentDay,currentDayMinutes = day, minutes
totalCost += convert_minutes_to_cost(currentDayMinutes)
return totalCost
def convert_minutes_to_cost(minutes):
if minutes <= 100:
return 1 * minutes
else:
return 2 * minutes - 100
July 31, 2018