-
-
Save wakemaster39/e3bf23439154383a744d248946efb7cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import os | |
dir = os.path.dirname(__file__) | |
f = open(os.path.join(dir, "data.txt")) | |
inputs = [int(x) for x in f] | |
# Question 1 answer | |
print(sum(inputs)) | |
seen = set() | |
current = 0 | |
count = 0 | |
while True: | |
for x in inputs: | |
current += x | |
if current in seen: | |
# Question 2 answer | |
print(current) | |
break | |
seen.add(current) | |
else: | |
print(count) | |
count += 1 | |
continue | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My solution: