Docsity
Docsity

Prepara tus exámenes
Prepara tus exámenes

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity


Consigue puntos base para descargar
Consigue puntos base para descargar

Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium


Orientación Universidad
Orientación Universidad


X65087 Walking vowels, Ejercicios de Informática

Ejercicio del jutge de la clase de informática

Tipo: Ejercicios

2021/2022

Subido el 06/11/2022

Kevin-eebe
Kevin-eebe 🇪🇸

7 documentos

1 / 1

Toggle sidebar

Esta página no es visible en la vista previa

¡No te pierdas las partes importantes!

bg1
Dessign the function vocales_andarinas(w) which, given a str w in lowercase,
rewrites it rotating by one the vowels.!
That is,!
where there is an a put e!
where there is an e put i!
...!
where there is an u put a
def vocales_andarinas(w):
'''
>>> vocales_andarinas("patata")
'petete'
>>> vocales_andarinas("aeiou")
'eioua'
>>> vocales_andarinas("mi mama me mima")
'mo meme mi mome'
'''
res = ''
for x in w:
if x == 'a': res += 'e'
if x == 'e': res += 'i'
if x == 'i': res += 'o'
if x == 'o': res += 'u'
if x == 'u': res += 'a'
if x not in 'aeiou': res += x
return res
if __name__ == '__main__':
import doctest
print(doctest.testmod())

Vista previa parcial del texto

¡Descarga X65087 Walking vowels y más Ejercicios en PDF de Informática solo en Docsity!

Dessign the function vocales_andarinas(w) which, given a str w in lowercase,

rewrites it rotating by one the vowels.

That is,

where there is an a put e

where there is an e put i

where there is an u put a

def vocales_andarinas(w): _'''

vocales_andarinas("patata") 'petete' vocales_andarinas("aeiou") 'eioua' vocales_andarinas("mi mama me mima") 'mo meme mi mome' '''_ res = '' for x in w: if x == 'a': res += 'e' if x == 'e': res += 'i' if x == 'i': res += 'o' if x == 'o': res += 'u' if x == 'u': res += 'a' if x not in 'aeiou': res += x return res if name == 'main': import doctest print(doctest.testmod())