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

[Python] Challenge 7 (Unreviewed) #361

Merged
merged 5 commits into from
Jan 23, 2017

Conversation

sarcodian
Copy link
Contributor

No description provided.

Copy link
Contributor

@ning-y ning-y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Code Correctness
  • Code Style
  • Code Documentation
  • Path Structure
  • Merge Pull Request

Once again, you lack documentation for your solution.

sum_n += i

for i in L:
sum_n_less_1 += i
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try the more pythonic and readable sum(L).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, thanks, didn't know it existed :)

sum_n_less_1 = 0

for i in range(len(L)+1):
sum_n += i
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try the more pythonic sum([i for i in range(len(L)+1)])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, can you provide a link or something that provides a deeper explanation of <i for i in range(len(L)+1)> syntax. I have seen it a lot in other code as well, but I don't get the logic behind how it works so I am wary of just using it. Or even if you provide the name for what that type of syntax is called I can google it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As sent to you in slack, here's a great video on the topic (and also for the reference of others)
https://www.youtube.com/watch?v=ZoWgzG_r2qo

@slandau3 slandau3 merged commit db4481b into YearOfProgramming:master Jan 23, 2017
@sarcodian sarcodian deleted the python_7 branch January 23, 2017 12:40
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.

None yet

3 participants