Skip to content

Commit ca62468

Browse files
committed
more descriptive local variables
1 parent 1307efe commit ca62468

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

project_euler/problem_057/sol1.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ def solution(n: int = 1000) -> int:
3131
>>> solution(10000)
3232
1508
3333
"""
34-
a, b = 1, 1
35-
res = []
34+
prev_numerator, prev_denominator = 1, 1
35+
result = []
3636
for i in range(1, n + 1):
37-
numerator = a + 2 * b
38-
denominator = a + b
37+
numerator = prev_numerator + 2 * prev_denominator
38+
denominator = prev_numerator + prev_denominator
3939
if len(str(numerator)) > len(str(denominator)):
40-
res.append(i)
41-
a = numerator
42-
b = denominator
40+
result.append(i)
41+
prev_numerator = numerator
42+
prev_denominator = denominator
4343

44-
return len(res)
44+
return len(result)
4545

4646

4747
if __name__ == "__main__":

0 commit comments

Comments
 (0)