Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exp = [line.rstrip('\n') for line in open("expenses.txt")]
- x = 0
- for i in range(len(exp)):
- for j in range(len(exp)):
- for k in range(len(exp)):
- x = int(exp[i]) + int(exp[j]) + int(exp[k])
- if x == 2020:
- x = int(exp[i]) * int(exp[j]) * int(exp[k])
- print(exp[i], "+", exp[j], "+", exp[k], "= 2020")
- print(exp[i], "*", exp[j], "*", exp[k], "=", x)
- break
- else:
- continue
- break
- else:
- continue
- break
- else:
- continue
- break
Advertisement
Add Comment
Please, Sign In to add comment