- #1
shakespeare86
- 21
- 0
Hello, I'm new using Mathematica and actually can't understand what's the problem in this code
The error I get is
Set::write: Tag Times in Null {} is Protected. >>
I've also tried to use an array or a table in the place of the list l, but the error persist.
It's like if after the nested for, I couldn't append elements to the list or add elements to an array.
Have you any idea to do what I would like to do?
Code:
l = {}
For[k = 1, k < 3,
For[j = 1, j < 3,
t1 = RandomInteger[{1, 10}];
t2 = RandomInteger[{1, 10}];
t = (t1 + t2)/2;
j++;
]
l = Append[l, t];
k++;
]
The error I get is
Set::write: Tag Times in Null {} is Protected. >>
I've also tried to use an array or a table in the place of the list l, but the error persist.
It's like if after the nested for, I couldn't append elements to the list or add elements to an array.
Have you any idea to do what I would like to do?
Last edited by a moderator: