Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leon #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Leon #5

wants to merge 1 commit into from

Conversation

leonplaza
Copy link

No description provided.

@bripollc
Copy link

Hola Léon,

Buen lab!!!! Continua así ✨ Te dejo solo un pequeño detalle:

  • Add a condition to the list comprehension above so that the last value in each subarray is printed, but only if it is less than or equal to 0.5.
list_subarray = [y[-1] for i in b for y in i if y[-1] <= 0.5]
print(list_subarray)

En tu código, cuando declaras if y[2] >= 0.5, estas restringiendo los valores que imprimes ya solo se continuarán iterando las subarrays si el tercer valor y[2] cumple la condición de ser mayor o igual a 0.5. Esto significa que, si la condición no se cumple, se omitirá por completo la subarray y, por el contrario, si se cumple, se imprimirá toda la subarray (no únicamente el tercer valor). No sé si me explico... 🫠 La manera de seleccionar el último valor sería usando y[2] o y[-1], sin necesidad de hacer una comparación.

  • Use a list comprehension to select and print the names of all CSV files in the /data directory. Mind slashes.
directory = ("../data")
file_lst = [i for i in os.listdir(directory) if i.endswith("csv")]
print(file_lst)

Te dejo la solución del último ejercicio:)

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