Weird character in hobbies array?


When I print the hobbies array, I get the output:

Enter your activity: hi
Enter your activity: hi
Enter your activity: hi
[u'hi', u'hi', u'hi']

I'm wondering what the 'u' character exactly is and why it's there. Can anyone explain this to me?

My code is shown below: :slight_smile:

hobbies = []

Add your code below!

for activity in range(3):
hobby = raw_input("Enter your activity:")
activity +=1

print hobbies


excuse the add your code below lol


raw_input gives unicode encoding, you can read about it here

If you want to get rid of it, you can cast it to a string:

hobby = str(raw_input("Enter your activity:"))


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