Appending to list with for loop


#1



https://www.codecademy.com/en/courses/python-beginner-en-cxMGf/1/2?curriculum_id=4f89dab3d788890003000096#


The code worked out fine, though when printing the result, in the list they showed 'u' in front of each items like below. Why this is happening and how can I get rid of it ?

result >>>

What is your hobby?: talk
What is your hobby?: play
What is your hobby?: lov
[u'talk', u'play', u'lov']
None


hobbies = []

# Add your code below!
for i in range(3):
    hobby = raw_input("What is your hobby?: ")
    hobbies.append(hobby)
print hobbies


#2

You've also got square brackets, commas, apostrophes and spaces in there which also are not part of the data. How would you get rid of that? The u's is just one of several things printed in addition to your data. Or what if you wanted to print each one on its own line? Why would it be printing all those things? What would it print instead if not what it currently prints?


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.