Jul-03-2018, 12:29 AM
When I run the following code, the user is asked 3 times "Name a hobby: ", so I enter fishing, hiking, coding then hit enter. When I then print the list hobbies, each item in the list has a u" in it. What is this and what am I doing that is putting it there?
Name a hobby: fishing
Name a hobby: hiking
Name a hobby: coding
[u'fishing', u'hiking', u'coding']
hobbies = [] for i in range(3): hobby = raw_input("Name a hobby: ") hobbies.append(hobby) print hobbiesThe result of running the code is the following:
Name a hobby: fishing
Name a hobby: hiking
Name a hobby: coding
[u'fishing', u'hiking', u'coding']