2 added 1 character in body
source | link

By far the simplest way is to do it in two lines:

a = Table[RandomReal[], {n, 10}]];
a[[1 ;; 3]] = b;
a[[7 ;; 10]] = b;
a

This gives the output:

{b, b, b, 0.378846, 0.475894, 0.533768, b, b, b, b}

By far the simplest way is to do it in two lines:

a = Table[RandomReal[], {n, 10}]
a[[1 ;; 3]] = b;
a[[7 ;; 10]] = b;
a

This gives the output:

{b, b, b, 0.378846, 0.475894, 0.533768, b, b, b, b}

By far the simplest way is to do it in two lines:

a = Table[RandomReal[], {n, 10}];
a[[1 ;; 3]] = b;
a[[7 ;; 10]] = b;
a

This gives the output:

{b, b, b, 0.378846, 0.475894, 0.533768, b, b, b, b}

1
source | link

By far the simplest way is to do it in two lines:

a = Table[RandomReal[], {n, 10}]
a[[1 ;; 3]] = b;
a[[7 ;; 10]] = b;
a

This gives the output:

{b, b, b, 0.378846, 0.475894, 0.533768, b, b, b, b}