+ 3

÷ is not working even its fixed with chr(247)

so im making cal app but i have 2 problems,the one is fixed by Tibor Santa which changing ("x") to chr(120) now the bug2 is same but ÷,i tried to fix by changing ("÷") to chr(247) but its still not working https://code.sololearn.com/cGnEynbsJ4Cb/?ref=app

12th Jan 2019, 12:54 PM
prisma
prisma - avatar
3 Réponses
+ 4
The character you want to print has the integer value 246. I obtained this result with the following loop : for i in range(200,256): print(i, chr(i)) If you want to see from 0 to 255, you'll have to do something like this : for i in range(256): try: print(i, chr(i)) except: print(i, "not printable")
12th Jan 2019, 1:29 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 3
chr(247) shows ≈ for me. Weird thing is, print('÷') also shows ≈ in Code Playground. When I try to print('≈'), I get a charmap error stating that the unicode cannot be mapped. You might want to fix that typo on line 19: int2 instead of int, ofc. When I input ≈ 1 2 it outputs 0.5, which is the correct division result. However, ÷ should be chr(247) and not ≈. I'm a little lost on this one. I think it has to do with setting the proper/default encoding standard.
12th Jan 2019, 1:11 PM
Hatsy Rei
Hatsy Rei - avatar
+ 2
Thx i thought ÷ is chr 247 because i know from website
12th Jan 2019, 1:36 PM
prisma
prisma - avatar