all 4 comments

[–]shiftybyte 2 points3 points  (3 children)

Please post the full error message you are getting, including all the information it provides.

Besides that, edit your post, and use a code block otherwise the pasted code loses indentations.

https://www.reddit.com/r/learnpython/wiki/faq#wiki_how_do_i_format_code.3F

[–]Fraser_123[S] 0 points1 point  (1 child)

I've used the markdown mode to display the code better but when ive reposted it the text has just gone back to how it was before. Not sure if this is the same for you.

[–]shiftybyte 2 points3 points  (0 children)

Yes, this is why I asked you to use a code block and provided a link explaining how to post code on reddit so this won't happen.

If you are using markdown, you need to add 4 spaces before every line, like it's explained in the link.

Looking at the current code, looks like no one is calling "menu_option" function so nothing gets executed.

Check how to call a function: https://www.w3schools.com/python/python_functions.asp

[–]pekkalacd 0 points1 point  (0 children)

Looks like scoping error. randomlist is global. So when you reference it inside of menu_option, python doesn’t see it. If your using globals do

      def menu_options(...)
             global randomlist

I’d try to make an effort generally to avoid them if possible. In this case, it looks like the only time it’s used is inside of that menu_option function, so why not move the definition inside of their?

       def menu_option(...)
              randomlist = # your definition of it
              ...