10. For your hobbies


#1
hobbies = []
for hobby in range(3):
    hobby = raw_input("Type a hobby: ")
    hobbies.append(hobby)
print hobbies

This code when ran with the inputs of "1", "2", and "3", give this: [u'1', u'2', u'3']. How did the "u" get there and why?


#2

@jareddygert,
Have a read
http://stackoverflow.com/questions/17012908/python-2-7-ipython-raw-input-and-appending-to-a-list-adds-u-before-each

Also
http://stackoverflow.com/questions/4915361/whats-the-difference-between-raw-input-and-input-in-python3-x


#3

Cool! Thanks. I get it now.


#4

I had the same problem, thanks for that answer.


#5

try this
hobby = str(raw_input("Please Enter Hobby"))


#6

Here's my code. Try it out and see the result!