Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1.    #!/usr/local/bin/python2.7
  2.    
  3.    
  4.    def main():
  5.    
  6.        total = 0;
  7.    
  8.        with open("day1.txt", 'r') as f:
  9.    
  10.           lines = f.readlines()
  11.  
  12.           for x in lines:
  13.               values = int(x)
  14.  
  15.               while values / 3 - 2 >= 0:
  16.                   new_values = ((values / 3) - 2)
  17.                   values = new_values
  18.                   total += values
  19.           print(total)
  20.  
  21.  
  22.   if __name__ == "__main__":
  23.       main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement