# Automatic Petrol Pump Algorithm

In this challenge we will implement an algorithm to be used in an Automatic Petrol Pump to interact with the customer and calculate the total cost of filling up their vehicle.

The fuel options and tariffs at this petrol station are as follows:

• Super Unleaded: £1.27 per litre,
• Diesel: £1.21 per litre,
• Diesel Premium: £1.34 per litre,

The petrol pump will interact with the customer by asking the following questions:

• What fuel do you require?
• Do you want to fill up (full tank capacity) and if not how many litres of fuel do you require?

The petrol pump will use this information provided by the customer as well as the tariffs provided above to calculate the total cost of this order.

To simulate a real life situation, we will assume that the customer’s vehicle has a tank capacity of 55 litres.
We will also assume that when the customer reach the petrol station, the vehicle still has some fuel left. To simulate this we will generate a random number between 0 and 55. This number will represent the number of litres left in the tank before filling up.

If the customer requires a full tank, the algorithm will calculate the quantity needed as follows:

Quantity Needed = Full Tank Capacity – Current Fuel Level

If the customer specifies a desired quantity (in litres), the algorithm will fill up the tank with the required quantity. However, if the required quantity combined with the current level of fuel in the tank exceeds the full tank capacity, the required quantity will be replaced to just the quantity that is needed using the same formula as mentioned above.

#### Petrol Pump Algorithm: Pseudocode

The suggested pseudocode for our Automatic Petrol Pump is as follows:

Your task is to use this pseudocode to implement this algorithm using Python.