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 #22

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

Leon #22

wants to merge 1 commit into from

Conversation

leonplaza
Copy link

No description provided.

@bripollc
Copy link

Léon:)

Nadie dijo que las funciones fueran fáciles 🙃 Pero muy buen lab en general!!! Felicidades! Las funciones te ahorrarán tiempo y simplificación de código así que me alegro de que se te den bien. Te dejo un par de detalles mínimos:

  • Now write a function that returns the largest element on a list

Tu código funciona correctamente y pasa el test, pero no necesitas declarar el else: continue dentro del foor loop, ya que el for loop seguirá automáticamente a la siguiente iteración independientemente del else :)

  • Write a function that takes a list and returns a list of the unique values.

Idem que en el ejercicio anterior.

También te dejo algunas manera de resolver el bonus:

  • Write a function that returns the mode of a list, i.e.: the element that appears the most times.
def mode_counter(arr):
    counter = {} 

    for i in arr:
        if i in counter:
            counter[i] += 1  
        else:
            counter[i] = 1

    mode = max(counter, key=counter.get)

    return mode
  • Write a function that receives a string of comma separated words and returns a string of comma separated words sorted alphabetically.
def sort_alpha(string):
    word_list = string.split(", ") 
    word_list.sort()  
    sorted_string = ", ".join(word_list)
    return sorted_string
a_string = "call, you, later"
sort_alpha(a_string)

A por el siguiente lab!!! 💪🏼

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