So I am working on a chat-bot for discord, and right now on a feature that would work as a todo-list. I have a command to add tasks to the list, where they are stored in a dict. However my problem is returning the list in a more readable format (see pictures).
def show_todo():
for key, value in cal.items():
print(value[0], key)
The tasks are stored in a dict
called cal
. But in order for the bot to actually send the message I need to use a return
statement, otherwise it'll just print it to the console and not to the actual chat (see pictures).
def show_todo():
for key, value in cal.items():
return(value[0], key)
Here is how I tried to fix it, but since I used return
the for-loop does not work properly.
So how do I fix this? How can I use a return
statement so that it would print into the chat instead of the console?