# Quiz - 8¶

Define a function `first_or_last_6` that checks whether 6 is the first or the last element in the list of numbers `numbers` passed as a parameter. If it is, return `True`, otherwise return `False`.

Examples:
`first_or_last_6([1, 2, 6])` -> `True`
`first_or_last_6([6, 1, 2, 3])` -> `True`
`first_or_last_6([3, 2, 1])` -> `False`

Define a function `same_ends` that takes a list `numbers` as a parameter, and returns `True` if the list of numbers has at least one element and the first element is the same as the last. Otherwise, return `False`.

Examples:
`same_ends([1, 2, 3])` -> `False`
`same_ends([1, 2, 3, 1])` -> `True`
`same_ends([1, 2, 1])` -> `True`

Define a function `common_ends` that takes two lists `a` and `b` as parameters, and checks that the first two numbers of both lists are equal or that the last two numbers of both lists are equal. Assume both lists have at least one element.

Examples:
`common_ends([1, 2, 3], [7, 3])` -> `True`
`common_ends([1, 2, 3], [7, 3, 2])` -> `False`
`common_ends([1, 2, 3], [1, 3])` -> `True`

Define a function called `mayor_extremo` that takes the list “numeros” as parameter, compares the ends of the list and returns a new list of the same size where all elements are the greatest magnitude extreme.

Examples:
`mayor_extremo([1, 2, 3])` -> `[3, 3, 3]`
`mayor_extremo([1, 3, 2])` -> `[2, 2, 2]`

Define a function called `sumar_primeros_dos` that takes the integer list `numeros` of any length as parameter and returns the sum of the first two elements. If the list has less than two elements, add 0s.

Examples:
`sumar_primeros_dos([1, 2, 3])` -> `3`
`sumar_primeros_dos([1, 1])` -> `2`
`sumar_primeros_dos([])` -> `0`

Define a function called `al_medio` that takes two integer lists `a` and `b` as parameters, and returns a list of size 2 that contains the middle elements of `a` and `b`. Assume that the lists have an odd length.

Examples:
`al_medio([1, 2, 3], [4, 5, 6])` -> `[2, 5]`
`al_medio([7, 7, 7], [3, 8, 0])` -> `[7, 8]`
`al_medio([5, 2, 9], [1, 4, 5])` -> `[2, 4]`

Define a function `fancy_date`. The function will take two parameters, `my_score` and `partner_score`. Assume that you are going to a restaurant with your partner. The parameters represent the score of the clothes you are wearing from 0 to 10. The higher the score, the more elegant you are dressed. Your clothes score will determine if you get a table at the restaurant or not, according to the following rules:

• If the score of one of the two clothing is less than or equal to 2, they will not be entitled to a table (`0`).

• If the scores are higher, then if one of them is very elegant (score >= 8) they will be entitled to a table (`2`).

• Otherwise, the answer is maybe (`1`).

So `fancy_date` returns a number between 0, 1, and 2, which mean No, Maybe, and Yes, respectively.

Examples:
`fancy_date(5, 10)` -> `2`
`fancy_date(5, 2)` -> `0`
`fancy_date(5, 5)` -> `1`

The squirrels soccer team normally plays when the temperature is between 60 and 90 degrees Fahrenheit. But in summer, the temperature exceeds the maximum temperature they will play, which is 90 degrees Fahrenheit. Define a function `squirrel_play` that takes 2 parameters, `temp` representing the temperature, and `is_summer`, which can be `True` if it’s summer or `False` if not. The function should return `True` if the squirrels play or `False` if they don’t.

Examples:
`squirrel_play(70, False)` -> `True`
`squirrel_play(95, False)` -> `False`
`squirrel_play(95, True)` -> `True`

Let’s simulate a speedometer that applies a fine if the maximum speed is exceeded:

• Speed <= 60: no fine

• Speed between 61 and 80: medium fine

• Speed above 80: severe fine

If it’s your birthday, the speed can be 5 km/h higher in all cases.
Define a function `apply_fine` that takes the parameters `speed` and `birthday`. The first represents the speed you were going, and the second can be `True` if it’s your birthday or `False` if it’s not. This function should return 0, 1 or 2 according to the following:

• no fine = 0

• medium fine = 1

• severe fine = 2

Examples:
`apply_fine(60, False)` -> `0`
`apply_fine(65, False)` -> `1`
`apply_fine(65, True)` -> `0`
`apply_fine(80, False)` -> `1`

Define a function `set_alarm` that takes two parameters: The first parameter `day` is a number from 0-6 that represents a day of the week according to the following:
day: 0 = Sunday, 1 = Monday, 2 = Tuesday, …, 6 = Saturday.
The second parameter `vacation` will be set to `True` if you’re on vacation or `False` if you’re not. The function will return a string that indicates when the alarm clock will ring according to the following:

• Weekdays: ‘07:00’

• Weekends: ‘10:00’

Unless you’re on vacation, in which case:

• Weekdays: ‘10:00’

• Weekends: ‘off’

Examples:
`set_alarm(1, False)` -> `"7:00"`
`set_alarm(1, True)` -> `"10:00"`
`set_alarm(6, True)` -> `"off"`
`set_alarm(0, False)` -> `"10:00"`