For your hobbies


#1



https://www.codecademy.com/en/courses/python-beginner-en-cxMGf/1/2?curriculum_id=4f89dab3d788890003000096#

Oops, try again. Prompt the user for input using raw_input() .

not sure, I do have the raw_input() function so I am not sure why I am getting an error


hobbies = []

for hobby in range(3):
    hobby = str(raw_input ("List a Hobby: "))
    hobbies.append(hobby)
print hobbies


#2

you have a space between raw_input and (, which give the exercise trouble to validate your code


#3

The output from raw_input is string type data so we do not need to cast it to string.


#4

actually, on codecademy its store the result as unicode, which if you print the lists shows u in front of the "strings"


#5

Face palm... Belay, belay. Just checked the lesson and see where this problem came up.

hobbies.append(hobby.encode("utf-8"))

is what I have for that lesson. Do you recall where this is introduced?


#6

what was introduced? .encode()? nowhere on codecademy, i only know codecademy stores the input as unicode, appylpye looked into it, but i forgot the outcome


#7

What about Unicode? Is it covered before this lesson or was it an oversight of the author?


#8

i think that appylpye and i concluded that codecademy thing (in any python lesson) the result is stored as unicode. i just opened the first exercise (link), ran this code:

a = []
b = raw_input("test: ")
a.append(b)
print a

also unicode, it seems to be a codecademy thing. You will have to ask appylpye


#9

thanks, I didn't realize that space would cause a problem


#10

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