# expflt2.py
# Written by Todd Wareham for CS 2500
"""
Given a string-representation of an exponential number as a
 command-line argument, compute and print the floating-point value
 of this exponential number.

Note that we assume that this esxponential number is in the
 range of floating-point values.
"""

import sys 
import re

if len(sys.argv) != 2:
    print "usage:", sys.argv, " exp-num"
    sys.exit(1)

mantissa = r"([+\-]?\d\.\d+)"
exponent = r"([+\-]\d+)"
r = re.compile(mantissa + "[eE]" + exponent)
m = r.match(sys.argv[1])
print "The floating-point value of ", sys.argv[1], " is ", \
      float(m.group(1)) * pow(10, int(m.group(2)))

