You are given a sequence of a journey in London, UK. The sequence will contain bus **numbers** and TFL tube names as **strings** e.g.

```python
['Northern', 'Central', 243, 1, 'Victoria']
```
Journeys will always only contain a combination of tube names and bus numbers. Each tube journey costs `£2.40` and each bus journey costs `£1.50`. If there are `2` or more adjacent bus journeys, the bus fare is capped for sets of two adjacent buses and calculated as one bus fare for each set.

Your task is to calculate the total cost of the journey and return the cost `rounded to 2 decimal places` in the format (where x is a number): `£x.xx`

Difficulty: introductory

Starter code:

def london_city_hacker(journey):
	

Solutions:
def london_city_hacker(journey): 
    # your code here
    tube = 2.40
    bus = 1.50
    total_cost = 0.00
    count = 0
    for link in journey:
        if isinstance(link, str):
            total_cost += tube
            count = 0
        else:
            if count == 0:
                total_cost += bus
                count +=1
            else:
                count = 0
    return '£{:.2f}'.format(total_cost)


def london_city_hacker(journey): 
    vehicle = "".join("t" if isinstance(j, str) else "b" for j in journey).replace("bb", "b")
    return f"£{sum(2.4 if v == 't' else 1.5 for v in vehicle):.2f}"

def london_city_hacker(journey):
    prices = []
    
    for stop in journey:
        prices.append(2.4 if type(stop) is str else 1.5)
        if prices[-2:] == [1.5, 1.5]:
            prices[-1] = 0
    
    return f"£{sum(prices):.2f}"

from itertools import groupby
def london_city_hacker(journey):
    tube_fare = lambda n: 2.4 * n
    bus_fare = lambda n: 1.5 * sum(divmod(n, 2))
    s = sum([bus_fare, tube_fare][a](len(list(g))) for a, g in groupby(map(lambda a: isinstance(a, str), journey)))
    return f'£{s:.2f}'

def london_city_hacker(journey): #Jai Shree Ram
    total=0.0
    l=[]
    for i in range(len(journey)):
        if type(journey[i])==str:
            total+=2.40
        else:
            if i<len(journey)-1 and type(journey[i+1])==int:
                l.append(journey[i])
                if len(l)==2:
                    total+=1.50 
                    l=[] 
            else:
                total+=1.50
                l=[]
    total=round(total,2)
    return '£'+str(total)+'0'

from itertools import groupby

def london_city_hacker(journey): 
    return f"£{sum(2.4 * len(list(l)) if k is str else (len(list(l)) + 1) // 2 * 1.5 for k,l in groupby(journey, type)):.2f}"

def london_city_hacker(journey):
    bus_counter = 0
    bus_price = 0
    tube_price = 0
    for i in journey:
        if type(i) is int:
            bus_counter += 1
            if bus_counter > 1:
                bus_counter = 0
                bus_price += 0
            else:
                bus_price += 1.5
        if type(i) is str:
            bus_counter = 0
            tube_price += 2.40
    return f"£{tube_price + bus_price:.2f}"

def london_city_hacker(journey): 
    
    sum = 0.0    
    isBus = False
    
    for i in journey :
        if len(str(i)) <= 3:
            if isBus :
                isBus = 0 
            else :
                sum += 1.50
                isBus = 1
        else :
            sum += 2.40
            isBus = 0
    
    sum = round(sum * 100) / 100
    
    return f'£{str(sum)}0'

def london_city_hacker(journey): 
    total_cost = 0
    adjacent_bus_tour = 0
    for tour in journey:
        if type(tour) == str:
            adjacent_bus_tour = 0
            total_cost += 2.40
        else:
            adjacent_bus_tour += 1
            if adjacent_bus_tour == 2:
                adjacent_bus_tour = 0
            else:
                total_cost += 1.50
    return f'£{total_cost:.2f}'

from itertools import groupby

def london_city_hacker(journey): 
    arr = list(map(type,journey))
    s = 0
    for k,g in groupby(arr):
        g = len(list(g))
        if k==str:
            s += 2.4*g
        else:
            s += 1.5*(g//2+(1 if g%2 else 0) if g>1 else g)
    return f'£{round(s,2):.2f}'