A shop keeps one row per order. The marketing team wants a short list: orders from a chosen set of countries that are either mid-sized or were placed by a VIP customer.
Write select_orders(df, countries, low, high).
df has the columns order_id (whole number), country (text), amount (number) and vip (True or False). countries is a list of country names. low and high are numbers with low <= high.
Keep a row when both of these are true:
country is one of countries, andamount is between low and high with both ends included, or its vip value is True.Return a new DataFrame holding only the columns order_id, country, amount, in that order, for the rows you kept. The rows stay in the order they have in df.
countries is not kept.