1.

What will be displayed by print(ord(‘b’) – ord(‘a’))?(a) 0(b) 1(c) -1(d) 2The question was asked in an interview.Question is from Strings in portion Strings of Python

Answer»

Correct OPTION is (b) 1

Easy explanation - ASCII value of b is one more than a. HENCE the output of this code is 98-97, which is EQUAL to 1.



Discussion

No Comment Found

Related InterviewSolutions