def task(n): res=[] for i in range(1,(n//5+1)): if i*5 < n: j=n-i*5 if j%3==0: res+=[(i,j//3)] return res r=task(124)print(str(r))
Standard input is empty
[(2, 38), (5, 33), (8, 28), (11, 23), (14, 18), (17, 13), (20, 8), (23, 3)]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!