Python Spanish C.2 exercise 15 string y salida en consola


#1

HI Guys in the chapter 2 exercise 15 in the python spanish I have found a issue.

When trying to submit the code it is returning the error:

Traceback (most recent call last):
File "python", line 1, in
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128)

it only submit correctly when I removed "¿" and the accent in the a "á".

How can I make it work with "¿" and "á" as it should be the correct grammar for Spanish speaker?

Original code giving by codeacademy:

nombre = raw_input("¿Cuál es tu nombre?")
mision = raw_input("¿Cuál es tu misión?")
color = raw_input("¿Cuál es tu color favorito?")

print "Ah, asi que tu nombre es %s, tu mision es %s, \
y tu color favorito es %s." % (nombre, mision, color)

code that work:
nombre = raw_input("Cual es tu nombre?")
mision = raw_input("Cual es tu mision?")
color = raw_input("Cual es tu color favorito?")

print "Ah, asi que tu nombre es %s, tu mision es %s, \
y tu color favorito es %s." % (nombre, mision, color)

Thanks

Carlos


#2

Hi, @cloudplayer84568 ,

In Python 2.x, which Codecademy currently offers, there are some complexities related to using many international characters in program code. While there are techniques to accommodate these characters, Codecademy has some bugs in some of its exercises related to this issue, but you managed to find a workaround. :slight_smile:

Fortunately, Codecademy plans to update to Python 3 early next year, but I'm not sure what will happen with the courses that are not written in English.

The following code executes in Python 3.5, which is available for download at the Official Python web site ...

# For Python 3.5
nombre = input("¿Cuál es tu nombre?")
mision = input("¿Cuál es tu misión?")
color = input("¿Cuál es tu color favorito?")

print("Ah, asi que tu nombre es %s, tu mision es %s, y tu color favorito es %s." % (nombre, mision, color))

#3

Thank you appylpye for you promptly answer.

I have tested with python 3.5 and works fine, It shouldn't have any problem when Codeacademy start using Python 3.x


#4

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