An inventory file lists hostnames typed by different people. Normalise each one by trimming whitespace, lowercasing it and removing a single trailing dot (the DNS root). Drop entries that are empty after normalising, and drop duplicates while keeping the first occurrence's position.
Implement normalize_hosts. Input: hosts: list[str]. Returns: list[str] in first-seen order.
def normalize_hosts(hosts: list[str]) -> list[str]:
return hosts
Run executes the public tests. Submit grades against public and hidden tests.
An inventory file lists hostnames typed by different people. Normalise each one by trimming whitespace, lowercasing it and removing a single trailing dot (the DNS root). Drop entries that are empty after normalising, and drop duplicates while keeping the first occurrence's position.
Implement normalize_hosts. Input: hosts: list[str]. Returns: list[str] in first-seen order.
def normalize_hosts(hosts: list[str]) -> list[str]:
return hosts
Run executes the public tests. Submit grades against public and hidden tests.