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

MIKI_PUIG #14

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

Conversation

Miquelpg6
Copy link

No description provided.

@sh-ih
Copy link

sh-ih commented Oct 13, 2023

Miquel,
Great job on this lab! 💯

Some comments:

On question 2, your function passes the test but there is a case where setting largest=0 would create some issues: when your array has only negative numbers. If you run: greatest([-1,-5,-800]) you’ll get 0 as result, instead of -1.
A way to deal with this cases is to set largest=+inf. In Python, +inf is an unbounded upper value.
Another option would be to set largest=arr[0]

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)

On question 9, you need to create a string that contains all the letters of the alphabet and then check one by one if those letters are contained on the string you want to check. If not, then your function returns False, otherwise, it returns True.

def pangram(string):
    alphabet = "abcdefghijklmnopqrstuvwxyz"
    for char in alphabet:
        if char not in string.lower():
            return False
    return True

On question 10, your function didn't pass the test because the conditions to check for uppercase and lowercase letters were not running correctly. Both methods are missing the parenthesis at the end: if i.isupper(): and if i.islower():

def check_pass(string):
    special_char = "#@!$%&()^*[{}]"
    len_ = False
    digit_ = False
    sp_ch = False
    upper = False
    lower = False
    
    if len(string) >= 8:
        len_ = True
    for i in string:
        if i.isdigit():
            digit_ = True
        if i in special_char:
            sp_ch = True
        if i.isupper(): #Here you were missing the parenthesis
            upper = True
        if i.islower(): #Here you were missing the parenthesis
            lower = True
    
    return len_ and digit_ and sp_ch and upper and lower

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