Adopted new convention from template

This commit is contained in:
David Doblas Jiménez 2022-09-28 20:30:06 +02:00
parent acb9f1f2ce
commit d56bb32696

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3 #!/usr/bin/env python
""" """
Created on 11 Sep 2019 Created on 11 Sep 2019
@ -34,8 +34,9 @@ def compute():
Find the value of d < 1000 for which 1/d contains the longest recurring Find the value of d < 1000 for which 1/d contains the longest recurring
cycle in its decimal fraction part. cycle in its decimal fraction part.
""" """
cycle_length = 0 cycle_length = 0
number_d = 0 ans = 0
for number in range(3, 1000, 2): for number in range(3, 1000, 2):
if number % 5 == 0: if number % 5 == 0:
continue continue
@ -43,10 +44,10 @@ def compute():
while 10**p % number != 1: while 10**p % number != 1:
p += 1 p += 1
if p > cycle_length: if p > cycle_length:
cycle_length, number_d = p, number cycle_length, ans = p, number
return number_d
return ans
if __name__ == "__main__": if __name__ == "__main__":
print(f"Result for Problem 26 is {compute()}")
print(f"Result for Problem 26: {compute()}")