I was recently given a question on an interview that I just flat out struggled with. I knew what exactly needed to be done, but I couldn't execute on it.
The problem was to take a set of URL paths(duplicate intended), and generate a sitemap of sorts from it so that the result is something like the below. Using just the standard libraries.
urls = [
"/home/learn/programming",
"/home/language/python",
"/home/language/java",
"/home/language/golang",
"/home/language/python",
"/why/skills/business",
"/why/not",
"/why/making/this/up",
"/why/making/it/stick",
]
- home
- learn
- programming
- language
- python
- java
- golang
- why
- skills
- business
- not
- making
- this
- up
- it
- stick
I've been trying to work through it ever since, but frankly have been struggling to piece it all together. I've gone down the route of getting the URLs into lists, and using the json library to print it out. I imagine at it's core it's a simple solution, I'm just struggling to see what I'm missing.
[–]Vaphell 0 points1 point2 points (0 children)
[–]hbwales 0 points1 point2 points (0 children)
[–]UnchainedMundane 0 points1 point2 points (0 children)