How can I make all the items on a list print on a line(in non list form)


#1

I'm doing problem seven on Practice Makes Perfect.
def reverse(text):
l = []
l.append(text)
for i in range(len(text)):
print l[0][abs(i-len(text))-1]
reverse("Hi!")


#2

You can convert each number to string and join them, but I think that function is supposed to return something, as opposed to printing the result.

', '.join(str(n) for n in range(5))


#3

Try this

from __future__ import print_function #import this if using python 2.7.x
def reverse(text):
    l = []
    l.append(text)
    for i in range(len(text)):
        print (l[0][abs(i-len(text))-1], end=" ")

reverse("Hi!")