0
How to have a space between strings ???
5 Respuestas
+ 4
s = 'Hello world'
s = " ".join(s[i:i+2] for i in range(0, len(s), 2))
print(s)
//OUTPUT He ll o wo rl d
+ 1
Explain further
+ 1
>>> a = 'Hello'
>>> b = 'world'
>>> a + ' '+ b #concatanate ' ' between them
'Hello world'
>>> print(a, b, sep=' ') #either use sep argument of print()
Hello world
0
print( "i like" + " " + "iron" + " " + "man" )
print( "i like", "iron", "man" )
print( "%s %s %s" % ( "i like", "iron", "man" ) )
- 1
when i write print ("i like" + ' iron' + "Man")
it comes ilikeironman NOT i like iron Man