10. For ur hobbies



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?')
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']

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.


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]


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