learn more

What will be the output of below program in python ? try out yourself and comment

char='A'

number=5

sum=ord(char)+number

print(sum)

 

 

Answer:  This program will print 70. 

why ?, because ord is a built in library function in python. ord function takes character literal as argument and returns its ASCII value(unicode value). ASCII value of 'A' is 65 and it is added to number value(i.e. 5) and answer is assigned to sum variable. print function displays the value of sum as 70.

P.S.-> ASCII stands for american standard code for information interchange. it defines the unicode for characters.