Avatar ·

Replacement in the line of double space for a single

📁 string, Advanced Python Topics, work

I have a line:

 str  =  'a l a m a k o t a '

as can be seen in the line, between the letters of the same word I have one gap, between the words two.

I tried to solve it, but failed:

I used to change double gaps to '`' ':

 for  i  in   range  ( len  ( str )- 1 ):  if   str  [i] ==  ' '   and   str