{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# PLC grading table" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import math\n", "\n", "min = 50\n", "max = 100\n", "\n", "def grade(points):\n", " if points < min:\n", " return str(5.0)\n", " if points >= max:\n", " return str(1.0)\n", " return str(\n", " round(1.0 + (9 - math.floor((points - min) / \n", " (max - min) * 10)) / 3, 1))" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'1.0'" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "grade(95)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }