Skip to content
Prev Previous commit
Next Next commit
08-hours_and_minutes
  • Loading branch information
kiddopro committed Feb 22, 2022
commit 1ba68eaedffd8c6dc35f707326660312211d14c7
4 changes: 2 additions & 2 deletions exercises/08-hours_and_minutes/README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ El programa debe imprimir 1 65 1 hora completa ha pasado desde la medianoche, 6
```
## Ejemplo de salida:
```py
(1, 65)
(2, 5)
```
## 💡 Pista:

+ Recuerda cuantos segundos hay en una hora y cuantos segundos en un minuto.
+ Recuerda cuantos segundos hay en una hora (3600) y cuantos segundos en un minuto (60).

+ Si no sabes cómo empezar la solución a esta asignación, por favor, revisa la teoría en esta lección:
https://snakify.org/lessons/print_input_numbers/
Expand Down
4 changes: 2 additions & 2 deletions exercises/08-hours_and_minutes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ The following function will tell us the time after midnight, that is, assuming t

## Example output:
```py
(1, 65)
(2, 5)
```
## 💡 Hint:

+ Remember how many seconds there are in an hour and how many seconds in a minute.
+ Remember how many seconds there are in an hour (3600) and how many seconds in a minute (60).

+ If you don't know how to start solving this assignment, please, review a theory for this lesson:
https://snakify.org/lessons/print_input_numbers/
Expand Down
9 changes: 9 additions & 0 deletions exercises/08-hours_and_minutes/solution.hide.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#Complete the function to calculate how many hours and minutes are passed since midnight.
def hours_minutes(secs):
hours = secs // 3600
mins = secs // 60
while (mins > 60):
hours += 1
mins -= 60

return (hours, mins)
13 changes: 11 additions & 2 deletions exercises/08-hours_and_minutes/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@
@pytest.mark.it('The function hours_minutes must exist')
def test_for_functon_existence(capsys, app):
assert callable(app.hours_minutes)

@pytest.mark.it('The function hours_minutes must return the correct output for 60 secs')
def test_for_file_output(capsys, app):
assert app.hours_minutes(60) == (0, 1)

@pytest.mark.it('The function hours_minutes must return the correct output for 3900 secs')
def test_for_file_output(capsys, app):
assert app.hours_minutes(3900) == (1, 65)
assert app.hours_minutes(3900) == (2, 5)


@pytest.mark.it('The function hours_minutes must return the correct output for 4004 secs')
def test_for_file_output(capsys, app):
assert app.hours_minutes(4004) == (1, 66)
assert app.hours_minutes(4004) == (2, 6)


@pytest.mark.it('The function hours_minutes must return the correct output for 60 secs')
def test_for_file_output(capsys, app):
assert app.hours_minutes(7320) == (4, 2)



Expand Down