Creating a function for Road Pricing
<blockquote>
  <p>The Transport Authority is implementing a new Road Pricing system. The authorities decided that the cars will be charged based on distance travelled, on a per mile basis. A car will be charged $0.50/mi, a van $2.1/mi and taxis travel for free. Create a function to determine how much a particular vehicle would be charged based on a particular distance. The function should take as input the type of the car and the distance travelled, and return the charged price.</p>
</blockquote>

<p>The problem above is what I have to do and the code below is what I have so far. The issue I have is that I'm receiving an error for not identifying car, van, and taxi before. But if I do so, it would print out all 3 situations. How would I be able to print out 1 outcome depending on the input for y?</p>

<pre><code>    def Road_Pricing():
        x = float(input("How many miles is driven?"))
        y = (input("What car was driven?"))
        if "car":
           print (.50*x)
        if "van": 
           print (2.1*x)
        if "taxi":
           print ("Free")
    Road_Pricing()
</code></pre>

<p>You have a problem with your <code>if</code> statement : firstly you are not checking any condition, secondly <code>input</code> returns a `string``</p>

<p>try this out instead :</p>

<pre><code>def Road_Pricing():
    x = float(input("How many miles are driven?"))
    type = input("What car was driven?")
    if type == 'car':
       print ("%f$ to pay" %.50*x)
    elif type == 'van': 
       print ("%f$ to pay" %2.1*x)
    elif type == 'taxi':
       print ("Free ride")
pass
</code></pre>

python function