Jan-24-2019, 10:04 PM
(This post was last modified: Jan-24-2019, 10:12 PM by grobattac37.)
Here is some code I wrote that finds some values: a,b,c,d,e, that satisfy some expression. I would like to know: how I could shorten this code (perhaps using a list comprehension?), how I could make the code more readable, if there is a more efficient way to do this, and any other tips you could give me. Any criticism is welcome as long as you also tell me how to address the criticism. Thanks!
nums = [2,3,5,7,9] for a in nums: for b in nums: for c in nums: for d in nums: for e in nums: x = a + b * c**2 + d**3 - e if x == 399: print(a,b,c,d,e)P.S. This code was written to complete a task in the synacor challenge, I recommend it if you have some spare time and want to test your skills. (I am stuck on the teleport task so any hints for that would also be appreciated).