Quiz - 4¶
Develop the function valores_extremos
which takes the parameter numeros
, representing a list of 10 random numbers between 0-100.
The function should return a tuple (a, b)
, where a and b are the maximum and minimum values respectively of the numeros
list. Solve the problem without using
the functions max
nor min
.
Example:
valores_extremos([15, 48, 0, 27, 13, 62, 32, 57, 85, 18])
-> (85, 0)
Develop the function pares_e_impares
which takes the parameter numeros
. numeros
represents a list of 20 random numbers between 1-100.
The function should return a tuple of lists of the form ([even], [odd])
, where even and odd are lists of even and odd numbers that are
in numeros
, respectively.
Develop the function intercalar_listas
which takes two parameters, l1
and l2
, representing lists of 10 random numbers between 1-100.
The function should generate a third list composed of the elements of l1
and l2
interleaved. This third list will be returned.
Example:
intercalar_listas([1, 3, 5, .....], [2, 4, 6, ....])
-> [1, 2, 3, 4, 5, 6, ....]
The function buscar_palabras
will be passed the following texto
as argument:
“The Python Software Foundation and the global Python community welcome and encourage participation by everyone. Our community is based on
mutual respect, tolerance, and encouragement, and we are working to help each other live up to these principles. We want our community to be more diverse: whoever you are, and
whatever your background, we welcome you.”
It should generate a list of words from this text using split()
. Then it should create a list of words that start or end with any
of the letters in the string "python"
. This list is the one that will be returned. Note: Don’t forget to first remove special characters
and be careful with capitalization.
Now you will develop the function buscar_palabras_2
, which will be passed the previous text as a parameter. Again you will separate the
text into words, just like you did in Exercise 4. This time, you should calculate the number of words within texto
that have any
of the letters in the string "python"
, and also have a length greater than 4 characters.