LOOPS_ for your hobbies


enter hobby GAME
enter hobby PYTHON
enter hobby ALOO
[u'GAME ', u'PYTHON', u'ALOO']

Why is it adding 'u' to beginning of each hobby name??

hobbies = []

Add your code below!

for i in range (3):
c=raw_input('enter hobby')
print hobbies


codecademy stores the result of the prompt as unicode, not as string. so the u is of unicode

cast to string (str()) to get rid of the u


I had the same question, changing my code to:

hobby = str(raw_input("What is your hobby?"))

got rid of the "u." Why has this condition not appeared in previous exercises?


given the u only shows when you print the list, not when you print the user input directly or each item of the list


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