0
$\begingroup$

I would like to replace all elements $1/2$ in tuples with $0$, How should i do that I tried already this one : sel1 = ReplacePart[sel[[#]], 1/2 -> 0]

The tuples are:

tuples = Tuples[{1, -1/2, 1/2}, {Lan, Lan}]; sel = Select[tuples, Total[#, 2] == 14 &]

$\endgroup$
  • 1
    $\begingroup$ Note that your question has little or nothing to do with tuples... but instead with any list. $\endgroup$ – David G. Stork Sep 19 '18 at 18:50
1
$\begingroup$

To replace all instances of 1/2 in sel, you can use ReplaceAll (/.) as

sel /. (1/2 -> 0)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.