bp Interview Question

5 min technical: You have a date, write a python code that returns next friday

Interview Answer

Anonymous

Jun 5, 2024

You can get the index of week from a dt.date. Friday should be index 4. Bellow that you can just get the diff and add it as a timedelta to the input date. Equal or above you can add 5 + 6 - curr_index as a timedelta