From 9e9a6aa5f447a74d56cb537aade0c10a5a558163 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 20 Sep 2018 11:45:02 +0000 Subject: [PATCH] Its done --- pairem.ipynb | 133 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 123 insertions(+), 10 deletions(-) diff --git a/pairem.ipynb b/pairem.ipynb index 5e3e281..2496226 100644 --- a/pairem.ipynb +++ b/pairem.ipynb @@ -30,17 +30,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "metadata": { "autoscroll": false, - "collapsed": false, "ein.hycell": false, "ein.tags": "worksheet-0", "slideshow": { "slide_type": "-" } }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[{'First Name': 'Felix', 'Last Name': 'Adam', 'GSE Email': 'felix.adam@barcelonagse.eu'}, {'First Name': 'Sixter Leonardo', 'Last Name': 'Alcivar', 'GSE Email': 'sixter.alcivar@barcelonagse.eu'}, {'First Name': 'Julia Bois', 'Last Name': 'Barnett', 'GSE Email': 'julia.barnett@barcelonagse.eu'}, {'First Name': 'Eric Alan', 'Last Name': 'Beckwith', 'GSE Email': 'eric.beckwith@barcelonagse.eu'}, {'First Name': 'Maia', 'Last Name': 'Brenner Stainfeld', 'GSE Email': 'maia.brennerstainfeld@barcelonagse.eu'}, {'First Name': 'Hannah', 'Last Name': 'Busshoff', 'GSE Email': 'hannah.busshoff@barcelonagse.eu'}, {'First Name': 'Hector Eulogio', 'Last Name': 'Cano', 'GSE Email': 'hector.cano@barcelonagse.eu'}, {'First Name': 'Reid', 'Last Name': 'Falconer', 'GSE Email': 'reid.falconer@barcelonagse.eu'}, {'First Name': 'Lucas', 'Last Name': 'Freire', 'GSE Email': 'lucas.freire@barcelonagse.eu'}, {'First Name': 'Hannah', 'Last Name': 'Gerits', 'GSE Email': 'hannah.gerits@barcelonagse.eu'}, {'First Name': 'Georgi Konstantinov', 'Last Name': 'Gulyashki', 'GSE Email': 'georgi.gulyashki@barcelonagse.eu'}, {'First Name': 'Ari', 'Last Name': 'Lam', 'GSE Email': 'ari.lam@barcelonagse.eu'}, {'First Name': 'Sam Peter', 'Last Name': 'MacIntyre', 'GSE Email': 'sam.macintyre@barcelonagse.eu'}, {'First Name': 'Oscar', 'Last Name': 'Martínez', 'GSE Email': 'oscar.martinez@barcelonagse.eu'}, {'First Name': 'Monika Anna', 'Last Name': 'Matyja', 'GSE Email': 'monika.matyja@barcelonagse.eu'}, {'First Name': 'Evelyn Maria', 'Last Name': 'Molina Bolaños', 'GSE Email': 'evelyn.molinabolanos@barcelonagse.eu'}, {'First Name': 'Jordi', 'Last Name': 'Morera Serra', 'GSE Email': 'jordi.morera@barcelonagse.eu'}, {'First Name': 'Konstantinos', 'Last Name': 'Niakaros', 'GSE Email': 'konstantinos.niakaros@barcelonagse.eu'}, {'First Name': 'Snorri', 'Last Name': 'Petersen', 'GSE Email': 'snorri.petersen@barcelonagse.eu'}, {'First Name': 'Maryam', 'Last Name': 'Rahbaralam', 'GSE Email': 'maryam.rahbaralam@barcelonagse.eu'}, {'First Name': 'Guillem', 'Last Name': 'Sitges', 'GSE Email': 'guillem.sitges@barcelonagse.eu'}, {'First Name': 'Callan James', 'Last Name': 'Windsor', 'GSE Email': 'callan.windsor@barcelonagse.eu'}, {'First Name': 'Sebastian', 'Last Name': 'Wolf', 'GSE Email': 'sebastian.wolf@barcelonagse.eu'}, {'First Name': 'Kaka', 'Last Name': 'Ye', 'GSE Email': 'kaka.ye@barcelonagse.eu'}, {'First Name': 'Maximilian', 'Last Name': 'Zebhauser', 'GSE Email': 'maximilian.zebhauser@barcelonagse.eu'}]\n" + ] + } + ], "source": [ "import csv\n", "\n", @@ -53,7 +60,6 @@ "execution_count": null, "metadata": { "autoscroll": false, - "collapsed": false, "ein.hycell": false, "ein.tags": "worksheet-0", "slideshow": { @@ -68,17 +74,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": { "autoscroll": false, - "collapsed": false, "ein.hycell": false, "ein.tags": "worksheet-0", "slideshow": { "slide_type": "-" } }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "5" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Write your own test for the assignment!\n", "\n", @@ -89,19 +105,116 @@ " {'First Name': 'Qux', 'Last Name': 'Quxson'},\n", " {'First Name': 'Quux', 'Last Name': 'Quuxson'},\n", "]\n", - "\n", - "pairs = make_pairs(test_students)\n", + "test_students[1]\n", + "len(test_students)\n", + "#pairs = make_pairs(test_students)\n", "\n", "# Write assertions here!\n", - "assert(type(pairs) == list)" + "#assert(type(pairs) == list)" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[{'First Name': 'Quux', 'Last Name': 'Quuxson'}]" + ] + }, + "execution_count": 90, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "students = [\n", + " {'First Name': 'Foo', 'Last Name': 'Funderson'},\n", + " {'First Name': 'Baz', 'Last Name': 'Bazerson'},\n", + " {'First Name': 'Bar', 'Last Name': 'Barson'},\n", + " {'First Name': 'Qux', 'Last Name': 'Quxson'},\n", + " {'First Name': 'Quux', 'Last Name': 'Quuxson'},\n", + "]\n", + "\n", + "list(students[-1:])" + ] + }, + { + "cell_type": "code", + "execution_count": 91, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[({'First Name': 'Quux', 'Last Name': 'Quuxson'},\n", + " {'First Name': 'Foo', 'Last Name': 'Funderson'}),\n", + " ({'First Name': 'Qux', 'Last Name': 'Quxson'},\n", + " {'First Name': 'Bar', 'Last Name': 'Barson'}),\n", + " {'First Name': 'Baz', 'Last Name': 'Bazerson'}]" + ] + }, + "execution_count": 91, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import random\n", + "\n", + "\n", + "students = [\n", + " {'First Name': 'Foo', 'Last Name': 'Funderson'},\n", + " {'First Name': 'Baz', 'Last Name': 'Bazerson'},\n", + " {'First Name': 'Bar', 'Last Name': 'Barson'},\n", + " {'First Name': 'Qux', 'Last Name': 'Quxson'},\n", + " {'First Name': 'Quux', 'Last Name': 'Quuxson'},\n", + "]\n", + "\n", + "def Randomizer(students):\n", + " random.shuffle(students)\n", + " #order = list(range(len(students)))\n", + " #random.shuffle(order)\n", + " #students = [students[i] for i in order]\n", + " return students\n", + " \n", + "def make_pairs(students):\n", + " first_half = students[:len(students)//2]\n", + " second_half = students[len(students)//2:]\n", + " student_pairs = list(zip(first_half, second_half)) + list(students[-1:])\n", + " return student_pairs\n", + "\n", + " #for i in range(len(students)-1):\n", + " #print(students[i],\"is paired with\", students[i+2])\n", + " #for i,k in students:\n", + " #print (students[i] + \"is paired with\" + students[k])\n", + " \n", + "\n", + "Randomizer(students) \n", + "list(make_pairs(students))" ] } ], "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.6.3" + }, "name": "Untitled.ipynb" }, "nbformat": 4,