Sure, here is a Python script that should do what you described:
import datetime
# Define a class to represent a question
class Question:
def __init__(self, description, probability=0, comment=""):
self.description = description
self.probability = probability
self.comment = comment
# Define a function to add a new question
def add_question(description):
q = Question(description)
questions.append(q)
# Define a function to choose a question and input probability and comment
def choose_question(index):
q = questions[index]
q.probability = input("Enter probability: ")
q.comment = input("Enter comment: ")
# Define a function to save the questions to a file
def save_questions():
with open("questions.txt", "w") as f:
for q in questions:
f.write(f"{q.description} {q.probability} {q.comment}\n")
# Initialize the list of questions
questions = []
# Add some example questions
add_question("What is the capital of France?")
add_question("What is the largest planet in our solar system?")
# Choose a question and input probability and comment
choose_question(0)
# Save the questions to a file
save_questions()
This script defines a Question class to represent a question, with attributes for the description, probability, and comment. It also defines several functions: add_question to add a new question to the list, choose_question to choose a question and input probability and comment, and save_questions to save the questions to a file.
The script then initializes the list of questions, adds some example questions, chooses a question and inputs probability and comment, and saves the questions to a file.
To use this script, you can run it in a Python interpreter or save it to a file and run it with the Python interpreter. For example:
$ python script.py
This will run the script and save the questions to a file called "questions.txt". You can then open the file in a text editor to view the questions and their probability and comment.