h2d.py (306B)
1 #!/usr/bin/env python3 2 # hex to decimal 3 # description: convert hexadecimal to decimal 4 5 while (True): 6 h = input('> ') 7 try: 8 print(int(h, 16)) 9 except ValueError: 10 if h == 'q' or h == 'quit' or h == 'exit': 11 exit() 12 else: 13 print(h, 'is not hexadecimal')