Project Answer
Create and solve project assignments, home-works, tests and exams using the reset-answer and answer built-in terminal commands.
reset-answer
reset-answer is the terminal command used to set the correct answer of a project, which is the answer that users are expected to enter using the answer.
Basic usage
There are two forms to the reset-answer command:
-
reset-answer <correct-answer> — enter the correct answer directly into the terminal.
You can use this, for instance, when the answer consists only of a single number or a single CSV line.
Examples:
- reset-answer 5055.48
- reset-answer "New York,Toronto,490.6"
-
reset-answer --file <answer-file> — enter the correct answer via a CSV file. Examples:
- reset-answer --file answer.csv
- reset-answer -f answer.csv
Correct answer feedback message
You can also set a feedback message that is printed out when the correct answer is entered. This can be useful, for instance, if you have devised a series of challenges, puzzles or questions that have to be answered in order. Then you can put the link to the next project in the feedback message.
Example:
> reset-answer 5055.48 --message "Next question: pifop.com/view/next-question"
answer
answer is the terminal command used to verify if an answer is correct. The command checks if the answer entered by the user — e.g. the student — matches the answer that the project creator — e.g. the teacher or instructor — has set with the reset-answer command.
Basic usage
There are two forms to the answer command:
-
answer <your-answer> — enter the answer directly into the terminal.
You can use this, for instance, when the answer consists only in a single number, or when it consists in
a single CSV line. Examples:
- answer 5055.48
- answer "New York,Toronto,490.6"
-
answer --file <answer-file> — enter the answer via a CSV file. Examples:
- answer --file answer.csv
- answer -f answer.csv
Answer case sensitivity and tolerance
The answer check is done cell-by-cell. Cells containing strings are compared in a case insensitive manner and cells containing numbers are compared with a 0.0001% difference tolerance.
Score and feedback message
If all of the cells of the entered answer are equal to the cells in the correct answer, the entered answer is considered to be 100% correct, and the message that the project creator has set using the reset-answer command, if any, will be printed out — see above.
If the entered answer is not 100% correct, a score will be printed out showing the percentage of cells in the entered answer that have the correct value. For instance, if the entered answer has 4 cells but only 3 of them are correct, the returned score will be 75%.
Answer format (CSV)
Both of the above commands expect the entered answers to be in the comma separated values (CSV) format.
Simply put, the CSV format is a textual representation of a table: each line is a row, and , (comma) is used to separate consecutive cells. See below some important aspects of the CSV format and how its values are interpreted on PIFOP.
Spaces surrounding a cell's content are ignored.
The following answers are equivalent:
- 212.98 , London , Paris
- 212.98,London,Paris
The answer check is case insensitive.
The following answers are equivalent:
- 212.98,London,Paris
- 212.98,london,PARIS
Cells containing numbers are compared with a tolerance of 0.0001%
If the difference between the expected value and the entered value is less than or equal to 0.0001% of the expected value, the values are considered to be equal. For instance, the following answers are equivalent:
- 212.9876,London,Paris
- 212.9874,London,Paris