Skip to content

Task completed minus bonus#25

Open
MairaMG wants to merge 2 commits intoIronhack-data-bcn-oct-2023:mainfrom
MairaMG:main
Open

Task completed minus bonus#25
MairaMG wants to merge 2 commits intoIronhack-data-bcn-oct-2023:mainfrom
MairaMG:main

Conversation

@MairaMG
Copy link
Copy Markdown

@MairaMG MairaMG commented Oct 13, 2023

No description provided.

@bripollc
Copy link
Copy Markdown

Maira:)

Felicidades!!! Buen trabajo! Muy muy buen lab, la verdad! Las funciones te ahorrarán tiempo y simplificación de código así que me alegro de que se te den bien ✨✨

Te dejo algunas maneras 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