Aug-02-2023, 04:03 PM
(This post was last modified: Aug-02-2023, 04:03 PM by deanhystad.)
What do you mean by:
Let's start with "What is the program supposed to do?" This is obviously a homework assignment. You should post the instructions along with the code. As is, I don't know what code you wrote (probably new_func()) or what the code is supposed to do.
The database is empty.
What are you doing here?
Quote:The code loads so I can test the instance but it doesn't produce an answer?The code produces the answer: "Here are some tips on how to reduce the environmental impact of your event:" Granted that is not a useful answer, but your program cannot produce any other answer because it only has one.
Let's start with "What is the program supposed to do?" This is obviously a homework assignment. You should post the instructions along with the code. As is, I don't know what code you wrote (probably new_func()) or what the code is supposed to do.
The database is empty.
# Create a database to store the questions and answers database = {}You never put anything in database, so it never finds any answers.
What are you doing here?
def new_func(): return "Here are some tips on how to reduce the environmental impact of your event:\n" answers = [new_func().strip()]