Skip to content

Leon#22

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

Leon#22
leonplaza wants to merge 1 commit intoIronhack-data-bcn-oct-2023:mainfrom
leonplaza:main

Conversation

@leonplaza
Copy link
Copy Markdown

No description provided.

@bripollc
Copy link
Copy Markdown

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