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

summer of '69 #593

Open
lawlll opened this issue May 17, 2024 · 0 comments
Open

summer of '69 #593

lawlll opened this issue May 17, 2024 · 0 comments

Comments

@lawlll
Copy link

lawlll commented May 17, 2024

im referring to the 'function practice solutions'

since while isnt gonna loop because of the code inside it, using if is better as it gets rid of the break statements too and does the same work but with lesser code
 

def summer_69(arr):
    total = 0
    add = True
    for num in arr:
        if add:
            if num != 6:
                total += num
            else:
                add = False
        if not add:
            if num == 9:
                add = True
    return total
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

No branches or pull requests

1 participant