Need help with ps2a.py here! I can do the part of finding numbers that are not solutions of the Diophantine Equation. But I can't think of a way to save them (using tuples?) using what I've learned from the class. Also I don't know how to make the program stop at where we find 6 consecutive solutions and print out the last n I saved. Please anyone give me some hint...many thanks! Calvin
As for the first part of the problem, maybe the related readings for the course can give you a hint. Important is to perceive that tuples are immutable in Python, you will have to create one each time through the function. As for the second problem, how about creating a count variable and every time you find a solution, count+= 1, else count = 0. And if count == 5, break. Something like that works okay.
OMG! This helps a lot! Thanks! I'll give it some thought and try again. Thank you bmp!
Technically, I don't think we need to save the solutions at all, just detect if a number is buyable or not.
Join our real-time social learning platform and learn together with your friends!