# Lab #5¶

## Before Kattis¶

1

Write a function called `count_to_n_w(n)` to print a count from 0 to `n-1`. This function should use a while loop.

2

Write a function called `add_one_n_times_w(a, n)` that will add one to a number `a` a total of `n` times. In the end, have this function `return` the value. This function must use a `while` loop. It should work such that:

```>>> ans = add_one_n_times(7, 5)
>>> print(ans)
12
```

3

Write a function called `count_to_n_f(n)` to print a count from 0 to `n-1`. This function should use a for loop. Hint: check out range.

4

Write another function called `add_one_n_times_f(a, n)` that will add one to a number `a` a total of `n` times, but this time with a `for` loop.

## Kattis Problems¶

Grab a scrap piece of paper to start scratching your ideas down on paper. The problems are getting tricky enough where this really is becoming a requirement.

1. https://open.kattis.com/problems/timeloop

2. https://open.kattis.com/problems/oddities

3. https://open.kattis.com/problems/fizzbuzz

4. https://open.kattis.com/problems/sibice (Think about how you would do this real life before you start coding)

5. https://open.kattis.com/problems/bus

6. https://open.kattis.com/problems/datum (more annoying than tough)

7. https://open.kattis.com/problems/dicecup (tough – grab that paper)

ENSURE WE HAVE RECORDED YOUR COMPLETION. FAILURE TO DO SO WILL RESULT IN A GRADE OF 0!

Warning

If you are in the online section, you must submit the .py (python scripts), not the .ipynb (notebook files). To get the python scripts from Colab, simply select File and in te dropdown menue, hit Download .py.