How can I properly print accented letters in Python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

How can I properly print accented letters in Python?

Here's a code which is supposed to print accented letters like á, é, í, ó, ú, ý. Instead, it prints different characters in Code Playground. https://code.sololearn.com/cYeXDL0t31Yf/?ref=app Why is it not printing it the way it should?

6th Mar 2018, 2:29 PM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
4 Answers
+ 12
Your code works in Pydroid 3. I think it's a Unicode problem (which is currently above my pay grade 😊). Here are a couple of links that might help. https://docs.python.org/3.3/howto/unicode.html https://stackoverflow.com/q/40640838 PS Congrats on COTD!
6th Mar 2018, 2:47 PM
David Ashton
David Ashton - avatar
+ 6
also works in QPython 3 on Android
6th Mar 2018, 3:46 PM
LordHill
LordHill - avatar
+ 5
Thanks David
6th Mar 2018, 2:51 PM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 4
@Good Luck Guys, Thanks for giving me an idea! I've been trying and looking for solutions using Unicode values, it turns out the answer is in ASCII. chr() solved it!
6th Mar 2018, 3:34 PM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar