Esempio n. 1
0
def trueFalseColored(input_bool):
    return Terminal.paintGreen(
        input_bool) if input_bool else Terminal.paintFail(input_bool)
Esempio n. 2
0
            while True:
                user_input = input("Add another? [y/n]: ")
                if user_input == 'n':
                    user_input = 'quit'
                    break
                elif user_input == 'y':
                    break
                else:
                    print(
                        Terminal.paintFail(
                            "Invalid input, please enter [y/n] or write [quit] to exit."
                        ))
            if user_input == 'quit':
                break

        print(Terminal.paintGreen("Saving..."))
        # TODO: need to create a truth table sort of thing, map out all the possibilities   ...
        # TODO: need to run tests! Write all the test cases...

        # This is the logic to save, may need refactoring: TODO: Refactor this, delegate this out to a function
        new_questionObj = Question.insertQuestion(new_question)
        for answerDict in all_answerDicts:
            answerObj = Answer.insertAnswer(answerDict["answer"])
            correctNess = answerDict["correctNess"]
            QA.insertQA(new_questionObj, answerObj, correctNess)

        print(f'\t {new_question}')
        for answerDict in all_answerDicts:
            print(
                f'\t\t- {answerDict["answer"]} ({answerDict["correctNess"]})')
        print(Terminal.paintGreen("Saved."))