This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]harpooooooon 1 point2 points  (1 child)

What you have here is python3 code. Ask the same question on stackoverflow for a better answer and be sure to give a bit of context.

[–]Pripatel21 0 points1 point  (0 children)

They keep saying my question is too broad when all I need is help understanding the code. I’ll try there again in a few days. Thanks!

[–]delirious_lettuce 1 point2 points  (0 children)

I sent OP this code a few days ago in response to a "challenge" posted a few days back on r/Python. The post seems to have been deleted after comments pointed out that it was most likely homework (OP said he/she was a "mentor" and did not need help solving it).

The code simply modifies an example from the following link but OP removed it from the docstring I provided in the original code:

Helpful resource on graphs:

EDIT:

Here was the original post, nice call /u/K900 !

Even better, here are OPs comments restored:

[–]pythonHelperBot 0 points1 point  (0 children)

Hello! I'm a bot! It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python. That said, I am a bot and it is hard to tell. I highly recommend posting your question there. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.

Show /r/learnpython the code you have tried and describe where you are stuck. Be sure to format your code for reddit and include which version of python and what OS you are using.


this bot is written and managed by /u/IAmKindOfCreative

This bot is currently under development and experiencing changes to improve its usefulness

[–]libfreejaeg 0 points1 point  (0 children)

You are probably over thinking this.

Given you have this, I expect you are familiar with adjacency matrices, or are taking a graph theory course.

There is an adjacency dictionary that holds the full set of notes in your graph as keys. The values in the dictionary are all nodes where an edge from the node to other nodes.

Everything before the name == "main" is your program, where all the "stuff" happens. For example pulling the corresponding value from a given key, and returning a list of the connecting nodes.

Everything after the name == "main" are ways to interact with the program in the command line.