10/19 Make sure you get 3 hobbies from user


So I've looked at the forums already to see where i was going wrong but my code is near identical to what I've seen and i have no idea what I'm doing wrong.

for hobby in range(3):
    hobby = raw_input("Tell me your hobbies.")

print hobbies


Your loop has to append not overwrite the variable.


a = 1
for i in range(3):
    a = i

# VS

a = [1]
for i in range(3):

# OUTPUT: 1 0 1 2


@microblaster93274 I am having the exact same issue. I have tried using different variations of code others users say worked, but end up getting this.

I am guessing something changed with this page because this code worked in this youtube clip @ 10:49 https://www.youtube.com/watch?v=0Z9hB5_KQKk&index=14&list=PLHdCowjFIBmI1UV60W1TVa7l91Psnw73E

I have also tried changing the range values in case anyone was wondering.


@thestarsof2050 It looks to me like its because you haven't put anything between the brackets after raw_input. That's what the error is saying, but that's really strange, because I tried deleting that on my one and it still worked perfectly, it just didn't as the question...

hobby = raw_input("What is your hobby?")


Thank you @zeziba!
I wouldn't have thought of that. I had been overwriting the variable all along too. :slightly_smiling:


In the end, this is the code that I typed, and it worked perfectly.

hobbies = []

for hobby in range(3):
    hobby = raw_input("What's your hobby?")
print hobbies


Why, when I do this, does my new list hobbies look like this in the output box?:
[u'sledding', u'skiing', u'snowboarding']. I don't know where these mysterious 'u's are coming from.


I also not understand why it shows 'u's


I also get these u' s in front of my input string. But somehow only when I print the whole list, not when I access a certain index. Does someone know why


Thanks man!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


I also got this "u" problem,is it related to my code?


same as well. sorry to have to revive this old thread, but anyone mind sharing why?