Commit 28c80e72 authored by Toby Hodges's avatar Toby Hodges

merged Karin's changes to WS2 debugging exercise

parents c9f841f1 763b6129
......@@ -1044,26 +1044,26 @@
"outputs": [],
"source": [
"# define variables to run function on\n",
"list0 = [[0.023, 0.026], [1.09,0.666], [0.346,0.953], [0.022, 0.026], [3.09,0.666], [0.336,0.943], [0.076, 0.426], [1.29,0.356], [0.146,0.953]]\n",
"list0 = [ [0.023, 0.026], [1.09,0.666] [0.346,0.953], [0.022, 0.026], [3.09,0.666], [0.336,0.943], [0.076, 0.426], [1.29,0.356], [0.146,0.953] ]\n",
"\n",
"# define function \n",
"def max_of_two(nmrs_list_list):\n",
"def max_of_two(nmrs_list_list)\n",
" \n",
" # define dict with assessment values\n",
" assessment_vals = {'Low': [], 'High': []}\n",
" assessment_vals = { 'Low': {}, 'High'; []}\n",
" \n",
" # run through elements (lists) in input list and categorise elements\n",
" for item in nmrs_list_list:\n",
" a = item[0]\n",
" a = item(0)\n",
" b = item[1]\n",
" if a<b:\n",
" if a not in assessment_vals['Low']:\n",
" if a not in assessment_vals['Low']:\n",
" assessment_vals['Low'].append(a)\n",
" if b not in assessment_vals['High']:\n",
" if b not in assessment_vals['High']:\n",
" assessment_vals['High'].append(b)\n",
" else:\n",
" if a not in assessment_vals['High']:\n",
" assessment_vals['High'].append(a)\n",
" else\n",
" if a not in assessment_vals[High]:\n",
" assessment_vals[High].append(a)\n",
" if b not in assessment_vals['Low']:\n",
" assessment_vals['Low'].append(b)\n",
" return assessment_vals\n",
......@@ -1072,28 +1072,28 @@
"assessment_vals = max_of_two(list0)\n",
" \n",
"# get output of code \n",
"print('The high values are {}'.format(assessment_vals['High']))\n",
"print('The high values are ()'.format(assessment_vals['High']))\n",
"print('The low values are {}'.format(assessment_vals['Low']))\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 2",
"language": "python",
"name": "python3"
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.1"
"pygments_lexer": "ipython2",
"version": "2.7.11"
}
},
"nbformat": 4,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment