Oct-23-2020, 09:34 PM
(Oct-22-2020, 08:43 AM)perfringo Wrote: Another way of doing it: 'multiply letter with it's queue number and join all letters to string'
>>> s = 'abcd' >>> ''.join(i*char for i, char in enumerate(s, start=1)) 'abbcccdddd'
Hi,
I understand overall your one liner but, if I may ask, how does the i in (i*char) contain a value before the loop is started?
TIA