1

I have a file main.py containing this:

import misc

def do_meme(self, raw_args):
    misc.memes()

do_meme("hello world")

and a file misc.py containing this:

import random

def bitch_lasanga_func():
    print("""
  Now playing: Bitch Lasagna
  1:07  ●━━━━━━───────  2:15
  ⇆ㅤㅤㅤ◁ㅤㅤ❚❚ㅤㅤ▷ㅤㅤㅤ↻
    """)

memes_list = {
    "bitch_lasanga":bitch_lasanga_func,
}

def memes():
    memes_list[random.choice(list(memes_list))]

When i run the file main.py i would expect the output to be this:

   Now playing: Bitch Lasagna
   1:07  ●━━━━━━───────  2:15
   ⇆ㅤㅤㅤ◁ㅤㅤ❚❚ㅤㅤ▷ㅤㅤㅤ↻

But instead i don't get anything. Can anyone help me debug?

NOTE: Full project here

1
  • Should you have something like this: memes_list[random.choice(list(memes_list))]() ? the paraenthesis at the end to execute the method ? Commented Mar 5, 2019 at 19:34

1 Answer 1

2

Your function memes just outputs the function bitch_lasanga_func (typo btw) without calling it. You have to call it with ().

def memes():
    memes_list[random.choice(list(memes_list))]()
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! This solved my problem! And thanks for mentioning the typo!👍

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.