⚑ IT Wisdom HTTPS everywhere, they said. The most secure system I've ever built still uses admin/admin because the client asked nicely.
Skilled Practitioner
4249 XP 1751 to Expert
Objective: Define and call a function that strips whitespace and lowercases a hostname.
Instructions

Create a file called lab3.py. Write a function called format_hostname(name) that:

  1. Strips leading and trailing whitespace
  2. Converts the name to lowercase
  3. Includes a one-line docstring as the first line inside the function body

Test it against these three hostnames:

hostnames = ["  SW-CORE-01  ", "RTR-EDGE-01", "  FW-DMZ-01"]

Your output must match exactly:

sw-core-01
rtr-edge-01
fw-dmz-01

Run it with python3 lab3.py. Paste your output below and submit.

πŸ’‘ Show Hint
def format_hostname(name): with a docstring on the next line inside the function. Use name.strip().lower() to clean the string. Loop through the list and call format_hostname() on each.
Paste Your Output
Next Lab β†’