1
def add_vat(price):
vat_rate = 0.2 # VAT 20%
total_cost = price * vat_amount
return total_cost
meal_price = 20.00
total_cost = add_vat(meal_price)
print(f"The total cost with VAT is £{total_cost}.")
# Rewrite, the function so that lines 2,3 & 4 are just 1 line of code.
                    
    return price * 1.2
                    
                
2
                    
    def find_vowels(text):
    vowels = "aEiou"
    count = 0
    for char in text:
        if char.lower() in vowels:
        count += 1
    return count
    print(find_vowels("cOdEfez"))
                    
                
                    
    1
                    
                
3
                
    def linear_search(data, target):
    for i in range(0, len(data)):
        if _____________________________:
        return f"Element found at index: {i}"
    result = linear_search([1, 3, 5, 7, 9], 7)
    print(result)                    
                
            

                    
                        
    def linear_search(data, target):
    for i in range(0, len(data)): 
if data[i] == target:

        return f"Element found at index: {i}"
    result = linear_search([1, 3, 5, 7, 9], 7)
    print(result)
Element found at index: 3
4
                
    num = 7
    if num % 2 == 0:
        print("number is odd")
    else:
        print("number is even")
                
            
                    
    def is_odd(num):
        return num % 2 != 0 
                    
                
5
                
    shop = [
        {"item":"bread", "price":1.2, "qty":1},
        {"item":"milk",  "price":0.9, "qty":2},
        {"item":"eggs",  "price":2.5, "qty":2}
    ]

    def calc_total(shop):
    
        ______________________________________

        ______________________________________
        
        ______________________________________
        
        return total 
                
            
                    
def calc_total(shop):
    total = 0
    for i in shop:
        total += i["price"] * i["qty"]
    return total
                    
                
6
                
    from random import choice

    def greeting(name):
        greets = ["Hello", "Bonjour", "Salaam"]
        
        return _____________________________________________
    
    print(greeting("Sarah"))                
                
            
                    
    from random import choice

    def greeting(name):
        greets = ["Hello", "Bonjour", "Salaam"]
        return f"{choice(greets)}, {name}!"
    
    print(greeting("Sarah"))