+ 1

[SOLVED] What is the fault of my code?

I tried this code on other python3 interpreters. It worked correctly. But why is it showing the exception part on SL's code playground, even if there is no exception? https://code.sololearn.com/c3UYgYLjY2oy/?ref=app

18th Oct 2019, 3:18 PM
Ishmam
Ishmam - avatar
2 odpowiedzi
+ 7
hi, issue is line 26 and line 27, which includes some emoji and other unicode characters. this does create an exception. As only ValueError is caught, this problem can not be detected. this is only an issue in playground, in regular IDE code will run properly. to avoid this problem in playground you can use this code on top of your file, so the code will owrk as expected: import sys import codecs sys.stdout = codecs.getwriter('utf_16')(sys.stdout.buffer, 'strict')
18th Oct 2019, 4:30 PM
Lothar
Lothar - avatar
+ 3
Lothar Very very thanks!!!
18th Oct 2019, 4:40 PM
Ishmam
Ishmam - avatar