hobbies = []

Add your code below!

for i in range(3):
print hobbies

If I input hi, hu, and ho
Why does it output
Why are there u’s?


Hi @miko6448,

The following test reveals that the user input is stored within hobbies as unicode type objects …

print type(hobbies[0])

Output …

<type 'unicode'>

You can get nicer output as follows …

for hobby in hobbies:
  print hobby

That will convert each item to a str object for output purposes, which omits the u prefix.

See Wikipedia: Unicode.


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