Python program to print ASCII code of given message


Write a program in python to print ASCII code of given message

----------------------------------------

msg=input("Enter Message to encode : ")

print("ASCII code for message : ")

for ch in msg:    

print(ord(ch),end=" ") # ord function return the ascii value of char

----------------------------------------

Output :-

Enter Message to encode : narendra modi

ASCII code for message : 

110 97 114 101 110 100 114 97 32 109 111 100 105 

Post a Comment

0 Comments