Python: iterate through a list -


I have a challenge that I want to solve using Python. They give the number 4 (25, 28, 38, 35) and they want us to place the base of a number in ............, a possible solution is 25 + 38-35 = 28. I have tried making a list with numbers, repeat them with some loops and if: lst = [25, 28, 38, 35]

  for z lst: x in Lst : L in lst: for v in lst: if z + xc == v: print z, x, c, v  

but when one runs for loops they repeat numbers , (25 + 25-25 = 25) And how do I solve this problem?

As a sign of Louis's comment, a good way is

 < Z> X, C, VItterless Permutation (LST) for code> importItterols: if z + xc == V: print z, x, c, v  

"better than nested Flat is better ", as this import to an interactive Python prompts will remind you: -)


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -