Output a Pyramid (or Highway)
05AB1E, 11 bytes
F²γN>×J}».C
Uses the 05AB1E encoding. Try it online!
05AB1E, 9 bytes
γ².D)ƶJ.C
Try it online!
γ
was, in no short amount, inspired by Adnan's answer; but S
would also work.
γ # Split into runs. | ['0','-','0']
².D) # Push n times. | [['0','-','0'],['0','-','0'],['0','-','0']]
ƶ # Lift by index. | [['0','-','0'],['00','---','00'],['000','---','000']]
J # Inner join. | ['0-0','00--00','000---000']
.C # Center. | Expected output.
Jelly, 14 13 bytes
LH×Ḷ}Ṛ⁶ẋżxЀY
Try it online!
How it works
LH×Ḷ}Ṛ⁶ẋżxЀY Main link. Arguments: s (string), n (integer)
L Get the length l of s.
H Halve it, yielding l/2.
Ḷ} Unlength right; yield [0, ... n-1].
× Compute [0, l/2, ..., l(n-1)/2].
Ṛ Reverse; yield [l(n-1)/2, ..., l/2, 0].
⁶ẋ Space repeat; create string of that many spaces.
xЀ Repeat in-place each; repeat the individual characters of s
1, ..., n times, yielding an array of n strings.
ż Zipwith; pair the k-th string of spaces with the k-th string of
repeated characters of s.
Y Sepatate the resulting pairs by linefeeds.