---
id: 69b1028d6e265413d0198a2c
title: "Challenge 233: Wake-Up Alarm"
challengeType: 29
dashedName: challenge-233
---

# --description--

Given a string representing the time you set your alarm and a string representing the time you actually woke up, determine if you woke up early, on time, or late.

- Both times will be given in `"HH:MM"` 24-hour format.

Return:

- `"early"` if you woke up before your alarm time.
- `"on time"` if you woke up at your alarm time, or within the 10 minute snooze window after the alarm time.
- `"late"` if you woke up more than 10 minutes after your alarm time.

Both times are on the same day.

# --hints--

`alarm_check("07:00", "06:45")` should return `"early"`.

```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(alarm_check("07:00", "06:45"), "early")`)
}})
```

`alarm_check("06:30", "06:30")` should return `"on time"`.

```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(alarm_check("06:30", "06:30"), "on time")`)
}})
```

`alarm_check("08:10", "08:15")` should return `"on time"`.

```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(alarm_check("08:10", "08:15"), "on time")`)
}})
```

`alarm_check("09:30", "09:45")` should return `"late"`.

```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(alarm_check("09:30", "09:45"), "late")`)
}})
```

`alarm_check("08:15", "08:25")` should return `"on time"`.

```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(alarm_check("08:15", "08:25"), "on time")`)
}})
```

`alarm_check("05:45", "05:56")` should return `"late"`.

```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(alarm_check("05:45", "05:56"), "late")`)
}})
```

`alarm_check("04:30", "04:00")` should return `"early"`.

```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(alarm_check("04:30", "04:00"), "early")`)
}})
```

# --seed--

## --seed-contents--

```py
def alarm_check(alarm_time, wake_time):

    return alarm_time
```

# --solutions--

```py
def alarm_check(alarm_time, wake_time):
    alarm_h, alarm_m = map(int, alarm_time.split(":"))
    wake_h, wake_m = map(int, wake_time.split(":"))

    alarm_minutes = alarm_h * 60 + alarm_m
    wake_minutes = wake_h * 60 + wake_m
    diff = wake_minutes - alarm_minutes

    if diff < 0:
        return "early"
    if diff <= 10:
        return "on time"
    return "late"
```
