Skip to content

[Pere] error handling lab#15

Open
perikoloso wants to merge 1 commit intoIronhack-data-bcn-oct-2023:mainfrom
perikoloso:main
Open

[Pere] error handling lab#15
perikoloso wants to merge 1 commit intoIronhack-data-bcn-oct-2023:mainfrom
perikoloso:main

Conversation

@perikoloso
Copy link
Copy Markdown

No description provided.

@bripollc
Copy link
Copy Markdown

Hola Pere:)

Un plaer corregir un lab tan ben fet, FELICITATS! Ademés has fet el BONUS!!!!!!! Olé. Et deixo uns detalls (sense importància). Bona feina, de debò. 🙌🏼

  • Remove all of the vowels in a string. Hint: make a list of the non-vowels. Use non_vowels as the name of the list.
non_vowels = [i for i in teststring if i not in ('a','e','i','o','u') and i != ' ']
print(non_vowels)

Correctísima tu respuesta! Te dejo un pequeño tip!!!! Si añades and i != ' ', también eliminarás los espacios en blanco y te quedarás únicamente son las consonantes.

  • Find all the consonants in the sentence 'The quick brown fox jumped over the lazy dog'.

Idem que en ejercicio anterior:) Puedes añadir and i != ' ' para eliminar los espacios en blanco.

  • Bonus 1
def int_to_2(x):
    return x**2

while True:
    x = input("Please, enter a number ")
    try:
        i = int(x)
        i = int_to_2(i)
        print(f"Well done! The square is: {i}")
        break
    except ValueError:
        print("Please enter a number.")

Super! Pero tu código no imprime el resultado final. Si añades esto en tu print The square is: {i}" lo tendrías!!!

A por el siguiente laaaaab!!! 👏🏼

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants