This commit is contained in:
2019-02-21 20:35:24 +01:00
parent 2cac531bf0
commit d3c5e22e1a

View File

@@ -185,7 +185,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 3,
"metadata": {},
"outputs": [
{
@@ -193,7 +193,13 @@
"output_type": "stream",
"text": [
"gent\n",
"['o', 'o']\n"
"['o', 'o']\n",
"{'d', 'r', 'o', 'b'}\n",
"{'d', 'e', 'n', 'b'}\n",
"{'d', 'b', 'n', 'e', 'item naar keuze'}\n",
"zit erin\n",
"{'b', 'd'}\n",
"{'d', 'b', 'r', 'n', 'o', 'e', 'item naar keuze'}\n"
]
}
],
@@ -220,22 +226,40 @@
"print(klinkers(l1))\n",
"\n",
"\n",
"set1 = set(l1)\n",
"set2 = set(l2)\n",
"\n",
"#is dit wa ge van mij verwacht?\n",
"l3 = l1+l2\n",
"print(l3)\n",
"print(set1)\n",
"print(set2)\n",
"\n",
"set2.add('item naar keuze')\n",
"\n",
"print(set2)\n",
"\n",
"\n",
"l3.append('item naar keuze')\n",
"\n",
"\n",
"if 'r' in l3:\n",
" print('zit erin')\n",
"if 'r' in set2 or 'r' in set1:\n",
" print('r zit erin')\n",
"else:\n",
" print('zit er niet in')\n",
" print('r zit er niet in')\n",
"\n",
" \n",
" \n",
" \n",
"def doorsnede(klein, groot):\n",
" final = set()\n",
" for i in klein:\n",
" if i in groot:\n",
" final.add(i)\n",
" return final\n",
"\n",
"def unie(een, twee):\n",
" final = een.copy()\n",
" final.update(twee)\n",
" return final\n",
"\n",
"print(doorsnede(set1,set2))\n",
"print(unie(set1,set2))\n",
"\n",
"\n",
"\n",
"\n",
"\n",