Skip to content

Instantly share code, notes, and snippets.

@djdunc
Created October 12, 2022 06:53
Show Gist options
  • Save djdunc/3c12d7eec80049bea4a3a1359621cb43 to your computer and use it in GitHub Desktop.
Save djdunc/3c12d7eec80049bea4a3a1359621cb43 to your computer and use it in GitHub Desktop.
Student Random List Generator
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"collapsed_sections": [],
"authorship_tag": "ABX9TyN5hfv57D3uWxdHKYVxCcLX",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/djdunc/3c12d7eec80049bea4a3a1359621cb43/student-random-list-generator.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "WzM1wWCn8iP_"
},
"outputs": [],
"source": [
"# generate random integer values\n",
"from random import seed\n",
"from random import randint\n",
"\n",
"# seed random number generator - change the seed to get a different list\n",
"seed(21)\n",
"\n",
"students = [\n",
"# \"Andre\tBourgeois\",\n",
"# \"Rita\tSmoldareva\",\n",
"# \"Patrick\tWhyte\",\n",
" \"Gil\tAdda\",\n",
" \"Edita\tButkute\",\n",
" \"Yining \tAn\",\n",
" \"Naomi\tCheng\",\n",
" \"Sophia\tChong\",\n",
" \"Shiqu\tGao\",\n",
" \"Sarah \tGomez\",\n",
" \"DY\tLim\",\n",
" \"Hanpu\tLiu\",\n",
" \"Leo\tLiu\",\n",
" \"Haiden\tMcgill\",\n",
" \"Xiaoya\tNie\",\n",
" \"Lucy\tQian\",\n",
" \"Yaman\tRawas Kalaji\",\n",
" \"Jack\tShiels\"\n",
" ]\n",
"\n",
"l = len(students)\n",
"print(\"Length of list:\")\n",
"print(l)\n",
"print(\"-----\")\n",
"\n",
"while l>0:\n",
" value = randint(0, l) - 1\n",
" call = students.pop(value)\n",
" print(call)\n",
" l = len(students)\n"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment