- Jul 21, 2017
- 1,590
- 2,413
Okay - this seems really darned basic, but I have been running into this for about 6 hours of research, I can get this to work in actual python, but not ren'py. I want to show the actual percentage of a grade, to two decimal places. First I calculate the grade:
$grade_percent = grade_score / grade_total * 100
Then I want to print it.
mc "[Student_Name], You received a [grade_percent] %% after answering [grade_score] correct out of [grade_total]"
When I do this, I get the outputs of the following for3 runs:
You received a 100.0% after answering 4 correct out of 4
You received a 66.666666666666666666666666% after answering 2 correct out of 3
You received a 50.0% after answering 1 correct out of 2
I want to format it with 2 decimal places. So the answers are 100.00%, 66.66%, 50.00% respectively (or one if that is all I can do). I thought I could do [grade_percent:.2] but it gives me an exponent instead of a number (which is not human readable). Any help would be appreciated.
$grade_percent = grade_score / grade_total * 100
Then I want to print it.
mc "[Student_Name], You received a [grade_percent] %% after answering [grade_score] correct out of [grade_total]"
When I do this, I get the outputs of the following for3 runs:
You received a 100.0% after answering 4 correct out of 4
You received a 66.666666666666666666666666% after answering 2 correct out of 3
You received a 50.0% after answering 1 correct out of 2
I want to format it with 2 decimal places. So the answers are 100.00%, 66.66%, 50.00% respectively (or one if that is all I can do). I thought I could do [grade_percent:.2] but it gives me an exponent instead of a number (which is not human readable). Any help would be appreciated.