"Create You Own" what's the error?


#1

c = [2,6,10,7]
for n in c:
    if n % 2 == 0:
        print "%s è pari!" %n
else:
    print "%s è dispar!" %n

it returns error: Traceback (most recent call last):
File "python", line 4, in
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128)

can't figure why


#2

the è is not a valid character it seems, just use e


#3

wow thx!!

now... how can we print these kind of characters?


#4

i tried it on repl.it, there it works

honest answer: I don't know, i am afraid you will have to google that


#5

possibly repl.it uses python 3?
the fact codecademy needs "raw_input" makes me think it still uses python 2

but i've just started with python so.. buh!

thx again!


#6

repl has both

yea, codecademy still uses python2

once you learn python, its enough to learn the differences


#7

Hi I'm stuck on the this exercise. I wrote a program to take 5 languages and sort them into front and backend. It prints all languages as backend so there is a problem with my if statement.....

languages = ['html', 'css', 'javascript', 'python', 'mysql']

for lan in languages:
if x == 'html' or x == 'css' or x == 'javascript':
print lan + " - This is front end stuff."
else:
if x == 'python' or x == 'mysql':
print lan + " - This is backend stuff."

The language sprint correctly but python and mysql doesnt say its backend. how do i fix this please?
Can someone pls tell me what ive done wrong?


#8

Sorry its prints all languages as front end.


#9

where does x come from? lan contain your languages, so you check if lan equals css and so on


#10

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