-5

Why am I getting the u' part in the Output window? Is it something to do with the append function or is this because of some bug in the compiler? FYI: I'm running this code on the Codecademy's Python compiler.

CODE:

hobbies = []

# Add your code below!
for x in range(3):
    hobby = raw_input("Enter your hobby")
    hobbies.append(hobby)
print hobbies

RESULT:
Enter your hobby "Reading"
Enter your hobby "TV"
Enter your hobby "Football"
[u'"Reading"', u'"TV"', u'"Football"']
None
Donald Duck
  • 8,409
  • 22
  • 75
  • 99
92Sanki
  • 35
  • 7

2 Answers2

1

The u indicates, that the variable is saved as unicode. See https://docs.python.org/2/howto/unicode.html

StegSchreck
  • 320
  • 4
  • 18
0

The u' just implies that the it's a unicode. It is not an error.

Try
type(variable_name)
to see the type.

Jithin Pavithran
  • 1,250
  • 2
  • 16
  • 41