Guest User

Untitled

a guest
Dec 1st, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. exp = [line.rstrip('\n') for line in open("expenses.txt")]
  2. x = 0
  3.  
  4. for i in range(len(exp)):
  5.     for j in range(len(exp)):
  6.         x = int(exp[i]) + int(exp[j])
  7.         if x == 2020:
  8.             x = int(exp[i]) * int(exp[j])
  9.             print(exp[i], "+", exp[j], "= 2020")
  10.             print(exp[i], "*", exp[j], "=", x)
  11.             break
  12.         else:
  13.             continue
  14.         break
  15.     else:
  16.         continue
  17.     break
  18.  
  19.    
  20.  
  21.            
  22.            
  23.            
  24.  
Advertisement
Add Comment
Please, Sign In to add comment