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

example optimization #33

Closed
wants to merge 1 commit into from
Closed

example optimization #33

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Apr 22, 2019

No description provided.

@astynax
Copy link
Contributor

astynax commented Apr 23, 2019

Thank you for your contribution but this example doesn't need to be simplified! Our course is targeted for absolute beginners so every example shows not optimal solution but the simple one.
This particular example should teach the student how to use long chains of if-elif - exactly in this repetative manner "check this than that".

BTW, your solution is sub-optimal and can be improved even more:

def is_arguments_for_substr_correct(string, index, length):
    return index >= 0 and index + length < len(string)

😉

@astynax astynax closed this Apr 23, 2019
@ghost ghost deleted the patch-1 branch July 11, 2019 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant