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

lab-functions #9

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Estherkii
Copy link

No description provided.

@sh-ih
Copy link

sh-ih commented Oct 13, 2023

Esther,
Great job!

Some comments:
On question 5, you could simplify your code by calling the functions you created on the previous two questions:

def oper_all(arr, oper):
    if oper == "+":
        return sum_all(arr)
    elif oper == "*":
        return mult_all(arr)

It is ok to use the initial code on each question (def name_of_function(): pass), just delete the pass and put your code. There is no need to keep that initial code and then repeat the def name_of_function.
In this lab, it won’t give you problems, but when you have two functions with the same name on different cells, later you may encounter issues because of you are not sure which was the last one to be run.

Regarding question 11, a possible way to solve it is to create a dictionary where each key is an element of your array and the value is the frequency. Then you can look for the key that has the biggest value

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