Programe working fine until emojis and LOTR letters ;-;

RAON2812 (230 points)
2 4 5
asked Oct 31, 2021 in HW2 by RAON2812 (230 points)
I tought my progra was running just fine up until i started testing with the random charcater tests (the ones in japanese and emoji etc)


the test test_emoji_5_10_100 has an expecting result of:
[3, 0, 1, 2, 4]  according to the test program

But i get:

[2, 3, 4, 0, 1]

Out of the 16 test runned by the test program, 10 come out as fail

and I really cant pin point WHY

Has anyone had the same problem?

4 Answers

angelaob (1190 points)
2 4 7
answered Oct 31, 2021 by angelaob (1,190 points)
Hi, I had the same problem. I realized I didn't write the code for summing the values of the whole strings correctly if two players have the same number of points, and also my code for the ranking list was wrong. Read carefully that part of the instructions for homework, because you have to fulfill two conditions at the same time: first the total number of matches won, in descending order, form most to least number of wins, but when two players have the same number of wins you order them according to their initial position, which is basically ascending order of indexes. Hope this helps!
gianluca5539 (9820 points)
3 6 44
answered Nov 1, 2021 by gianluca5539 (9,820 points)
Be sure to handle the ties in the final leaderboard as requested, that caused the same problem in my case.
KilianS (3590 points)
5 9 27
answered Nov 2, 2021 by KilianS (3,590 points)
try printing out the emojis acsii values and check if it returns the right values. are you sure the error only occurs with the emojis and japanese thingies? i thought i had the same error, but for me the problem was just that it was the longer strings.
Simone Russolillo (5790 points)
5 10 22
answered Nov 2, 2021 by Simone Russolillo (5,790 points)
I've got the same problem and I can't see the reason why it happens. I thought the problem was in case of tie but instead the final scores are wrong. The thing is they are wrong just for some tests while for the others it works fine.
angelaob (1190 points)
2 4 7
commented Nov 2, 2021 by angelaob (1,190 points)
final scores you mean the final ranking list? it could be that you have a problem with the ranking list only when some players have the same number of matches won, which happens in some tests and not in others. so your program works well when every player has a different number of matches won