""" Exer. 4.5 from "A primer on..." The exercise only asks us to handle the error with missing command line arguments, but this version also handles arguments of the wrong format (ValueError). """ import sys try: F = float(sys.argv[1]) except IndexError: print('Please provide a command line argument') exit() except ValueError: print('The argument must be a pure number') exit() C = (F - 32) * 5.0 / 9 print(f'{F} degrees F is {C:.2f} degrees C') """ Terminal> python f2c_cml_exc.py Please provide a command line argument Terminal> python f2c_cml_exc.py 56f The argument must be a pure number Terminal> python f2c_cml_exc.py 56 56.0 degrees F is 13.33 degrees C """