10. For ur hobbies


#1



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


Hi. The code works fine, but there are some weird artefacts.


hobbies = []

for x in range(3):
    hobby = raw_input('What\'s ur favourite hobbies?')
    hobbies.append(hobby)
print hobbies

The output looks smt like this:

What's ur favourite hobbies? sleeping
What's ur favourite hobbies? running
What's ur favourite hobbies? coding
[u'sleeping', u'running', u'coding']
None

I get 'u' in front of any hobby. I tried to comment out lines of code, change all the variables/lists but it keeps showing up. Sup with that?

Thank you in advance.


#2

That 'u' just means unicode. It isn't affecting anything.

If it really bothers you, hack this in above your print statement
hobbies = [str(r) for r in hobbies]


#3

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