# Quiz - 9¶

Develop the function `near_ten`

that receives an integer `n`

and returns `True`

when `n`

is a multiple of 10, or when `n`

is one or two units away from it. Otherwise, return `False`

.

Examples:

`near_ten(12)`

-> `True`

`near_ten(17)`

-> `False`

`near_ten(19)`

-> `True`

Develop a function called “suma_loca” that receives three integers “a”, “b”, and “c”. The function must return the sum of the three numbers with the condition that if any number appears twice, it will not be counted in the sum.

Examples:

`suma_loca(1, 2, 3)`

-> `6`

`suma_loca(3, 2, 3)`

-> `2`

`suma_loca(3, 3, 3)`

-> `0`

Develop the function called “suma_con_suerte” that receives three integers “a”, “b”, and “c”. The function must return the sum of the three numbers with the condition that if one of the numbers is **13**, it won’t count in the sum, as well as all the numbers to its right.

Examples:

`suma_con_suerte(1, 2, 3)`

-> `6`

`suma_con_suerte(1, 2, 13)`

-> `3`

`suma_con_suerte(1, 13, 3)`

-> `1`

Develop the function called “caracteres_dobles” that receives a string “s” and should return the original string duplicated.

Examples:

`caracteres_dobles('The')`

-> `"TThhee"`

`caracteres_dobles('AAbb')`

-> `"AAAAbbbb"`

`caracteres_dobles('Hi-There')`

-> `"HHii--TThheerree"`

Develop the function `count_greeting`

which receives a string `s`

as a parameter and returns the number of times the string `"hello"`

appears in `s`

.

Examples:

`count_greeting ("abc hello ho")`

-> `1`

`count_greeting ("ABChello hello")`

-> `2`

`count_greeting ("hellohello")`

-> `2`

Develop the function `cat_dog`

which receives a string `s`

as a parameter and returns `True`

if the string `"cat"`

and the string `"dog"`

appear the same number of times in the string `s`

or returns `False`

otherwise. | br | | br |
Examples:

`cat_dog ("catdog")`

-> `True`

`cat_dog ("catcat")`

-> `False`

`cat_dog ("1cat1dog")`

-> `True`

Develop the function `count_code`

which receives a string `s`

as a parameter and returns the number of times the string `"code"`

appears in `s`

, but with the condition that the letter `'d'`

can be exchanged for any other letter. Thus, the strings `"coze"`

and `"coze"`

should be counted equally.

Examples:

`count_code("aaacodebbb")`

-> `1`

`count_code("codexxcode")`

-> `2`

`count_code("cozexxcope")`

-> `2`

Knowing that the function `lower()`

converts the characters of a string to lowercase. Develop a function called `end_equals`

that receives two strings `a`

and `b`

as parameters. The function will return `True`

if the string `b`

is found at the end of string `a`

or if the string `a`

is found at the end of string `b`

.

Examples:

`end_equals("Hiabc", "abc")`

-> `True`

`end_equals("AbC", "HiaBc")`

-> `True`

`end_equals("abc", "abXabc")`

-> `True`

Develop the function `count_pairs`

that receives a list `numbers`

of integers and returns the number of even numbers in the list.

Examples:

`count_pairs([2, 1, 2, 3, 4])`

-> `3`

`count_pairs([2, 2, 0])`

-> `3`

`count_pairs([1, 3, 5])`

-> `0`

Develop the function `` suma_con_mas_suerte ‘’ that receives a list `` numbers ‘’ of integers and returns the sum of the numbers in the list with the condition that if one of the numbers is ** 13 ** , this is not counted in the sum as well as all numbers that are to its right. | br | | br | Examples: | br | `` suma_con_mas_suerte ([1, 2, 2, 1]) ‘’ -> `` 6 ‘’ | br | `` suma_con_mas_suerte ([1, 1]) ‘’ -> `` 2 ‘’ | br | `` suma_con_mas_suerte ([1, 2, 13, 1, 13]) ‘’ -> `` 3 ‘’ | br | `` suma_con_mas_suerte ([13, 1, 2, 3, 4]) ‘’ -> `` 0 ‘’ | br |

Develop the function `tiene_2`

that receives a list `numeros`

of integers as parameter and returns `True`

if there are two consecutive equal numbers in the list, and `False`

otherwise.

Examples:

`tiene_2([1, 2, 2])`

-> `True`

`tiene_2([1, 2, 1, 2])`

-> `False`

`tiene_2([2, 1, 2])`

-> `False`

Develop the function `suma_en_lista`

that receives two parameters, an integer `n`

and a list `numeros`

of numbers. The function should return `True`

if there are two different elements in the list whose sum is `n`

, and `False`

otherwise.

Examples:

`suma_en_lista(5, [1, 2, 3, 4])`

-> `True`

`suma_en_lista(9, [1, 2, 3, 4])`

-> `False`

`suma_en_lista(0, [1, 2, 3, 4])`

-> `False`

`suma_en_lista(8, [1, 2, 3, 4])`

-> `False`

`suma_en_lista(4, [2, 2, 2, 2])`

-> `False`

`suma_en_lista(4, [2, 2, 1, 3])`

-> `True`

In a construction it is desired to build a row of bricks. There are small bricks and large bricks. Small bricks are 1 unit in length while large bricks are 5 units in length. Develop the function `build_row`

which receives three parameters, `num_small_bricks`

, `num_large_bricks`

, and `row_length`

. These parameters are integer numbers that represent the quantity of small bricks, quantity of large bricks, and the length of the row you want to build, respectively. The function must return `True`

if it is possible to build the row, or `False`

otherwise.

Examples:

`build_row(3, 1, 8)`

-> `True`

*Explanation*: To build a length of 8 meters, 1 large brick and 3 small bricks would be used.

*Therefore*: 1 + 1 + 1 + 5 = 8

`build_row(3, 1, 9)`

-> `False`

*Explanation*: To build a length of 9 meters it wouldn’t be possible because there are only 3 small bricks (1 meter in length) and 1 large brick (5 meters in length).

*Therefore*: 1 + 1 + 1 + 5 < 9 in this case 1 large brick and 4 small bricks would be needed.

`build_row(3, 2, 10)`

-> `True`

*Explanation*: To fill a length of 10 meters, only the 2 available large bricks would be used.

*Therefore*: 5 + 5 = 10