# File: ord.py # Program to convert a character to internal representation # # Matt Bishop, ECS 10, Spring 2014 # # 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 if len(inch) != 1: print("One character at a time, please!") else: # print the ordinal values for each character print(inch, "-->", ord(inch)) # that's all, folks! print("Bye!")