Format the output
Sometimes your standard out is a little hard to read. Take this multilevel hash and make it human readable.
Start file
{Vertex('x'): {Vertex('v'): Edge(Vertex('v'), Vertex('x')), Vertex('z'): Edge(Vertex('z'), Vertex('x')), Vertex('y'): Edge(Vertex('y'), Vertex('x'))}, Vertex('y'): {Vertex('x'): Edge(Vertex('y'), Vertex('x')), Vertex('w'): Edge(Vertex('w'), Vertex('y')), Vertex('z'): Edge(Vertex('z'), Vertex('y'))}, Vertex('z'): {Vertex('x'): Edge(Vertex('z'), Vertex('x')), Vertex('y'): Edge(Vertex('z'), Vertex('y')), Vertex('u'): Edge(Vertex('u'), Vertex('z'))}, Vertex('u'): {Vertex('v'): Edge(Vertex('v'), Vertex('u')), Vertex('w'): Edge(Vertex('w'), Vertex('u')), Vertex('z'): Edge(Vertex('u'), Vertex('z'))}, Vertex('v'): {Vertex('u'): Edge(Vertex('v'), Vertex('u')), Vertex('x'): Edge(Vertex('v'), Vertex('x')), Vertex('w'): Edge(Vertex('w'), Vertex('v'))}, Vertex('w'): {Vertex('u'): Edge(Vertex('w'), Vertex('u')), Vertex('v'): Edge(Vertex('w'), Vertex('v')), Vertex('y'): Edge(Vertex('w'), Vertex('y'))}}
End file
{ Vertex('x'): { Vertex('v'): Edge(Vertex('v'), Vertex('x')), Vertex('z'): Edge(Vertex('z'), Vertex('x')), Vertex('y'): Edge(Vertex('y'), Vertex('x')) }, Vertex('y'): { Vertex('x'): Edge(Vertex('y'), Vertex('x')), Vertex('w'): Edge(Vertex('w'), Vertex('y')), Vertex('z'): Edge(Vertex('z'), Vertex('y')) }, Vertex('z'): { Vertex('x'): Edge(Vertex('z'), Vertex('x')), Vertex('y'): Edge(Vertex('z'), Vertex('y')), Vertex('u'): Edge(Vertex('u'), Vertex('z')) }, Vertex('u'): { Vertex('v'): Edge(Vertex('v'), Vertex('u')), Vertex('w'): Edge(Vertex('w'), Vertex('u')), Vertex('z'): Edge(Vertex('u'), Vertex('z')) }, Vertex('v'): { Vertex('u'): Edge(Vertex('v'), Vertex('u')), Vertex('x'): Edge(Vertex('v'), Vertex('x')), Vertex('w'): Edge(Vertex('w'), Vertex('v')) }, Vertex('w'): { Vertex('u'): Edge(Vertex('w'), Vertex('u')), Vertex('v'): Edge(Vertex('w'), Vertex('v')), Vertex('y'): Edge(Vertex('w'), Vertex('y')) } }
View Diff
1c1,32 < {Vertex('x'): {Vertex('v'): Edge(Vertex('v'), Vertex('x')), Vertex('z'): Edge(Vertex('z'), Vertex('x')), Vertex('y'): Edge(Vertex('y'), Vertex('x'))}, Vertex('y'): {Vertex('x'): Edge(Vertex('y'), Vertex('x')), Vertex('w'): Edge(Vertex('w'), Vertex('y')), Vertex('z'): Edge(Vertex('z'), Vertex('y'))}, Vertex('z'): {Vertex('x'): Edge(Vertex('z'), Vertex('x')), Vertex('y'): Edge(Vertex('z'), Vertex('y')), Vertex('u'): Edge(Vertex('u'), Vertex('z'))}, Vertex('u'): {Vertex('v'): Edge(Vertex('v'), Vertex('u')), Vertex('w'): Edge(Vertex('w'), Vertex('u')), Vertex('z'): Edge(Vertex('u'), Vertex('z'))}, Vertex('v'): {Vertex('u'): Edge(Vertex('v'), Vertex('u')), Vertex('x'): Edge(Vertex('v'), Vertex('x')), Vertex('w'): Edge(Vertex('w'), Vertex('v'))}, Vertex('w'): {Vertex('u'): Edge(Vertex('w'), Vertex('u')), Vertex('v'): Edge(Vertex('w'), Vertex('v')), Vertex('y'): Edge(Vertex('w'), Vertex('y'))}} --- > { > Vertex('x'): { > Vertex('v'): Edge(Vertex('v'), Vertex('x')), > Vertex('z'): Edge(Vertex('z'), Vertex('x')), > Vertex('y'): Edge(Vertex('y'), Vertex('x')) > }, > Vertex('y'): { > Vertex('x'): Edge(Vertex('y'), Vertex('x')), > Vertex('w'): Edge(Vertex('w'), Vertex('y')), > Vertex('z'): Edge(Vertex('z'), Vertex('y')) > }, > Vertex('z'): { > Vertex('x'): Edge(Vertex('z'), Vertex('x')), > Vertex('y'): Edge(Vertex('z'), Vertex('y')), > Vertex('u'): Edge(Vertex('u'), Vertex('z')) > }, > Vertex('u'): { > Vertex('v'): Edge(Vertex('v'), Vertex('u')), > Vertex('w'): Edge(Vertex('w'), Vertex('u')), > Vertex('z'): Edge(Vertex('u'), Vertex('z')) > }, > Vertex('v'): { > Vertex('u'): Edge(Vertex('v'), Vertex('u')), > Vertex('x'): Edge(Vertex('v'), Vertex('x')), > Vertex('w'): Edge(Vertex('w'), Vertex('v')) > }, > Vertex('w'): { > Vertex('u'): Edge(Vertex('w'), Vertex('u')), > Vertex('v'): Edge(Vertex('w'), Vertex('v')), > Vertex('y'): Edge(Vertex('w'), Vertex('y')) > } > }
Solutions
The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!
Check out these helpful resources to improve your Vim skills... Game on.
Unlock 39 remaining solutions by signing in and submitting your own entry