Spaced-out numbers
Python, 32 bytes
lambda l:'%%%ds'%len(l)*len(l)%l
An anonymous function that takes a tuple as input. Either numbers or strings work.
Example:
l=(1,33,333,7777)
'%%%ds'
## A "second-order" format string
'%%%ds'%len(l) -> '%4s'
## Inserts the length as a number in place of '%d'
## The escaped '%%' becomes '%', ready to take a new format argument
## The result is a format string to pad with that many spaces on the left
'%%%ds'%len(l)*len(l) -> '%4s%4s%4s%4s'
## Concatenates a copy per element
'%%%ds'%len(l)*len(l)%l -> ' 1 33 3337777'
## Inserts all the tuple elements into the format string
## So, each one is padded with spaces
05AB1E, 3 bytes
Code:
Dgj
Explanation:
D # Duplicate the input array
g # Get the length
j # Left-pad with spaces to the length of the array
Try it online! or Verify all test cases.
JavaScript (ES7), 37 bytes
a=>a.map(v=>v.padStart(a.length,' '))
Input: Array of strings
Output: Array of strings
f=
a=>a.map(v=>v.padStart(a.length,' '))
;
console.log(f(['0']))
console.log(f(['1']))
console.log(f(['2','3']))
console.log(f(['2','10']))
console.log(f(['4','5','6']))
console.log(f(['17','19','20']))
console.log(f(['7','8','9','10']))
console.log(f(['100','200','300','0']))
console.log(f(['1000','400','30','7']))
console.log(f(['1','33','333','7777']))
console.log(f(['0','0','0','0','0','0']))