the code says it is a error type but
Question: I've got this code.

    
    
    #!/usr/bin/python
    
    from optparse import OptionParser   #import the OptionParser object from this module
    
    parser = OptionParser()
    
    parser.add_option("-f", "--first", dest="meal", help="prix repas", type="float")  
    parser.add_option("-s", "--second", dest="tip", help="le tip", type="float")
    parser.add_option("-t", "--third", dest="tax", help="tax", type="float")
    
    
    (options, args) = parser.parse_args() 
    
    tax_value = options.meal * options.tax
    meal_with_tax = tax_value + options.meal
    tip_value = meal_with_tax * tip
    
    if not (options.meal and options.tip): 
    parser.error("You need to supply an argument for -s")
    
    print "le prix du repas est '{}'.".format(options.meal)
    print "Le tip est de '{}'.".format(options.tip)
    print "Le tip est de '{}'.".format(options.tip)
    

Each time I'm running it with the following command line

`./tip_re1_arg.py -s 5 2 3`

I've got this error `tax_value = options.meal * options.tax TypeError:
unsupported operand type(s) for *: 'NoneType' and 'NoneType'`

Why? It seems that I've done everything right in term of type. Or did I?

Sorry, I'm very much of a beginner in Python.


Answer: You have explicitly configured the parser to expect the parameters as options:

    
    
    ./tip_re1_arg.py -f 5 -s 2 -t 3
    
    ./tip_re1_arg.py --first 5 --second 2 --third 3
    

Currently your input arguments end up in `args`.

