+ 1

Does == operator in python compares any character with its ascii value?

For Ex : 'A'==65 or 'A'=='65'. Does any of them returns true?

17th Jan 2018, 2:20 AM
Divyansh
2 Answers
+ 6
Both would return false, but ord('A')==65 would return true :)
17th Jan 2018, 2:29 AM
Dapper Mink
Dapper Mink - avatar
+ 6
And 'A' == chr(65) would return True also. 🙂 (p.s. don't forget the capital T)
17th Jan 2018, 5:03 AM
David Ashton
David Ashton - avatar