# File: ord.py # Program to convert a character to internal representation # # Matt Bishop, ECS 10, Spring 2012 # # keep going until there is no more input while True: # here we read a character # but end the loop on an EOF (^D on most systems) try: inch = input("Enter character: ") except EOFError: break # print the ordinal values for each character print(inch, "-->", ord(inch)) # that's all, folks! print("Bye!")