Fill forward attendance

Write codeEasy11 minDatabricks and Snowflake style

Your task

A teacher's attendance sheet is a day-ordered list of status strings such as "present" or "late", but days the teacher forgot to record are the empty string "". Clean the column by filling forward: replace each missing entry with the most recent recorded status. If the sheet starts with missing days (nothing to carry yet), use fallback for those. Example: (["present", "", "late", ""], "absent") gives ["present", "present", "late", "late"].

Examples

fill_forward(log: list[str], fallback: str) -> list[str]
Example 1
Inputfill_forward(["present", "", "late", ""], "absent")
Output["present", "present", "late", "late"]