DNPotapov / Codewars-katas-

0 stars 0 forks source link

Upper Strength (7 kyu) #17

Open DNPotapov opened 1 year ago

DNPotapov commented 1 year ago
def alex_mistakes(number_of_katas, time_limit):
    count = 0
    delay = 0
    time_doing = number_of_katas*6
    if time_doing == time_limit:
        return count
    while(time_doing + delay*2 <= time_limit):
        if count == 0:
            delay = 5
        else:
            delay = delay * 2
        time_doing += delay
        count += 1
    return count
DNPotapov commented 1 year ago

Alex is transitioning from website design to coding and wants to sharpen his skills with CodeWars. He can do ten kata in an hour, but when he makes a mistake, he must do pushups. These pushups really tire poor Alex out, so every time he does them they take twice as long. His first set of redemption pushups takes 5 minutes. Create a function, alexMistakes, that takes two arguments: the number of kata he needs to complete, and the time in minutes he has to complete them. Your function should return how many mistakes Alex can afford to make.

DNPotapov commented 1 year ago

https://www.codewars.com/kata/571640812ad763313600132b