Advertisement
n8henrie

Sarah's Math Problem

Oct 5th, 2013
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. #! /usr/bin/env python3
  2.  
  3. def solve():
  4.     x = 0
  5.     while True:        
  6.         for y in range((x - 5) + 1):
  7.             for z in range((round(x / 2)) + 1):
  8.                 if x + y + z == 60 and x - y == 5 and x / 2 == z:
  9.                     yield x, y, z
  10.         x += 1        
  11.            
  12. answer = next(solve())
  13. print(answer)
  14. # (26, 21, 13)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement