Navid Nassiri
Navid Nassiri

Reputation: 11

Python converting a split function back

What I want my answer to look like: Hello World

Notice that it is not a string so it does not have apostrophes around it

m = 'Hello World'
w = m.split()
for final in w:
    (final = ??, end = ' ')
Hello World

The code i want looks very similar to this, I just forgot what to put for final and end

Upvotes: 0

Views: 58

Answers (1)

Mike
Mike

Reputation: 20196

I'm not sure what the question is, but I'll at least say something relevant.

>>> m = 'Hello World'
>>> w = m.split()
>>> n = ' '.join(w)
>>> print(n)
Hello World

Here, 'Hello World' is split on the spaces, so you just have to join the pieces with spaces.

Upvotes: 5

Related Questions