Skip to content

Conversation

b63
Copy link
Contributor

@b63 b63 commented Aug 31, 2019

Hello,
This would be my first contribution, so if there is anything I could have done better, I would greatly appreciate any feedback.
Thanks!

for j in range(k):
s = a_i[j] + addend
a_i[j] = s % 10
addend = s // 10
Copy link
Member

@cclauss cclauss Aug 31, 2019

Choose a reason for hiding this comment

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

Combine 131 and 132 into a single line with builtin divmod():
addend, a_i[j] = divmod(s, 10)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice! also changed it in a few more places

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

The single letter variable names are really old school. Can we use names instead that help the reader understand what the algorithm is doing? ddn means nothing to me.

c_pp, ddn = next_term(a_i, k - 1, i + dn, n) What?!?

@b63
Copy link
Contributor Author

b63 commented Aug 31, 2019

My bad, changed some of the less descriptive names and also added some comments to aid readability.

@cclauss cclauss merged commit d567a9e into TheAlgorithms:master Sep 1, 2019
@b63 b63 deleted the problem_551 branch September 2, 2019 03:37
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
* solution to problem 551 from project euler

* renamed variables, and added more comments to improve readabilty
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