Your question is Search Insert Position in Array. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a sorted array of distinct integers nums and an integer target, return the index if target is found. If it is not found, return the index where it should be inserted to keep the array sorted. The input is an array of integers and a target integer; the output is a single integer index.
def search_insert(nums, target):