Daily Coding Challenge - Browser History

Tell us what’s happening:

I do not understand why:

get_browser_history([“example.com”, “example.com/about”, “Back”, “example.com/contact”, “example.com/blog”, “Back”, “Back”, “Forward”]) should return [[“example.com”, “example.com/contact”, “example.com/blog”], 1].

Why is “example.com/about” not expected to be in the history?

Your code so far

def get_browser_history(commands):
    

    return commands

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36

Challenge Information:

Daily Coding Challenge - Browser History
https://www.freecodecamp.org/learn/daily-coding-challenge/2026-04-03

notice how it says “and discards any forward history”

URL" - Where URL is a web address ("freecodecamp.org" for example). Navigates to the given URL, adds it to the history at the next position, and discards any forward history

so the back moves you position 0, and when a new url is provided, position 1 is replaced with the new url

1 Like