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

[Pere Martin] - lab list comprehension notebook done #7

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

Conversation

perikoloso
Copy link

No description provided.

@perikoloso perikoloso changed the title lab list comprehension notebook done [Pere Martin] - lab list comprehension notebook done Oct 11, 2023
@bripollc
Copy link

Hola Pere,

Muy muy buen lab! Felicidades 🙌🏼 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 = [k[-1] for i in b for k in i if k[-1] <= 0.5]
print(list_subarray)

Tu código da correcto pero no está del todo bien planteado porque cuando declaras el statement z == k[-1], estás comparando el valor de z con el tercer valor de la subarray k[-1]. El último valor siempre será el tercero, porque las subarrays solo tienen 3 valores, por lo que es redundante. No sé si me explico... 🫠 La manera de seleccionar el último valor sería usando k[2] o k[-1], sin necesidad de hacer una comparación.

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