Challenge - Chick Fil A¶
You decide to invest in a series of billboards along interstate 10 to advertise your stylish new chicken restaurant, Chic-fil-A 🐔.
- You buy three billboards evenly spaced starting from mile marker 17 and ending on mile marker 28.
- You buy another three billboards starting on mile marker 32 and ending on mile marker 36.
- In order, from mile marker 17 to 36, your billboards display these ads: A, B, C, C, B, A.
Determine how far each B ad is from your restaurant which is located at mile marker 30.
# ads / restaurant*: A B C * C B A
# billboards: --|-----|-----|---|---|--|--|--
# mile markers: 17 28 30 32 36
In [1]:
%pip install numpy
import numpy as np
Requirement already satisfied: numpy in /home/samrat/Documents/numpy-torch-tutorials/venv/lib/python3.8/site-packages (1.24.4) Note: you may need to restart the kernel to use updated packages.
In [4]:
before = np.linspace(start=17, stop=28, num=3, dtype=int)
before
Out[4]:
array([17, 22, 28])
In [6]:
after = np.linspace(start=32, stop=36, num=3, dtype=int)
after
Out[6]:
array([32, 34, 36])
In [10]:
before_b = before[[len(before) // 2]]
after_b = after[[len(after) // 2]]
b = np.concatenate((before_b, after_b))
b
Out[10]:
array([22, 34])
In [12]:
np.absolute(b - 30)
Out[12]:
array([8, 4])
In [ ]: