Quiz - 7

Develop the function multi_cadena that receives as parameters a string s and a positive integer n and returns a new string that contains n copies of the original string

Examples:
multi_cadena("Hola", 2) -> "HolaHola"
multi_cadena("Hola", 5) -> "HolaHolaHolaHolaHola"

Develop the function expandir_cadena that receives a string s and returns a new string following the pattern described in the examples

Examples:
expandir_cadena("Code") -> "CCoCodCode"
expandir_cadena("abc") -> "aababc"
expandir_cadena("ab") -> "aab"

Develop the function contar_apariciones_9 that receives as parameter a non-empty list of integers numeros and returns how many times the number 9 appears in the list

Example: contar_apariciones_9([1, 99, 9]) -> 1

Develop the function verificar_comienzo_9 that receives a list of integer numbers numeros and verifies if at least one of the first four numbers is a 9

Examples:
verificar_comienzo_9([1, 2, 9, 3, 4]) -> True
verificar_comienzo_9([1, 2, 3, 4, 9]) -> False
verificar_comienzo_9([1, 2, 3, 4, 5]) -> False
verificar_comienzo_9([1, 2, 9]) -> True

Develop the function hola_usuario that receives as a parameter a string nombre that represents a user’s name and returns a greeting using this name

Examples:
hola_usuario("Bob") -> "¡Hola Bob!"
hola_usuario("Alice") -> "¡Hola Alice!"
hola_usuario("X") -> "¡Hola X!"

Develop the function crear_etiquetas that receives two strings etiqueta and palabra and returns a new formatted string following the pattern of the examples

Examples:
crear_etiquetas("i", "Yay") -> "<i>Yay</i>"
crear_etiquetas("i", "Hello") -> "<i>Hello</i>"
crear_etiquetas("cite", "Yay") -> "<cite>Yay</cite>"

Develop the function repetir_letras that receives a string s of at least two characters and returns a new string with the last two letters repeated three times

Examples:
repetir_letras("Hello") -> "lololo"
repetir_letras("abb") -> "bbbbbb"
repetir_letras("Hi") -> "HiHiHi"

Develop the function otra_repetir_letras (variation of the Exercise 7 function) that receives a string s of at least two characters and a positive integer n and returns a new string with the last two letters repeated n times

Examples:
otra_repetir_letras("Hello", 3) -> "lololo"
otra_repetir_letras("abb", 1) -> "bb"
otra_repetir_letras("Hi", 5) -> "HiHiHiHiHi"

Develop the function primera_mitad that receives a string s and returns the first half of the original string

Examples:
primera_mitad("WooHoo") -> "Woo"
primera_mitad("HelloThere") -> "Hello"
primera_mitad("abcdef") -> "abc"

Develop the function remove_first_last that receives a string s of at least two characters and returns a string without the first or last character.

Examples:
remove_first_last("Hello") -> "ell"
remove_first_last("python") -> "ytho"
remove_first_last("coding") -> "odin"

Develop the function rotate_left_2 that receives a string s of at least two characters and returns the original string rotated 2 positions to the left.

Examples:
rotate_left_2("Hello") -> "lloHe"
rotate_left_2("Hi") -> "Hi"

You have attempted of activities on this page