Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions day01/Python Data Types.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,7 @@
"cell_type": "code",
"execution_count": 27,
"metadata": {
"id": "8fYoL4aLwpVi",
"scrolled": false
"id": "8fYoL4aLwpVi"
},
"outputs": [],
"source": [
Expand Down Expand Up @@ -338,11 +337,33 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 13,
"metadata": {
"id": "gs4lLKoKwpVp"
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"t[0]: 12345\n",
"t: (12345, 54321, 'hello!')\n",
"(12345, 54321)\n",
"v: ([1, 2, 3], [3, 2, 1])\n",
"v=([1, 2, 3], [3, 2, 1])\n"
]
},
{
"data": {
"text/plain": [
"([1, 2, 3, 100], [3, 2, 1])"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# You can leave the parentheses off, if you like.\n",
"t = (12345, 54321, 'hello!')\n",
Expand All @@ -351,7 +372,7 @@
"print(t[:2])\n",
"# they can contain mutable objects:\n",
"v = ([1, 2, 3], [3, 2, 1])\n",
"print('v: ', v)\n",
"print('v: ', v) \n",
"v[0].append(100)\n",
"v"
]
Expand All @@ -371,7 +392,7 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": null,
"metadata": {
"id": "sue6pbeDwpVu"
},
Expand Down Expand Up @@ -566,7 +587,7 @@
"\n",
"# Iterate over pairs of (i, name) which have both index and name.\n",
"for (i, name) in enumerate(a):\n",
" print('Foo: {} {}'.format(i, name))"
" print(f'Foo: {i} {name}')"
]
},
{
Expand Down Expand Up @@ -660,9 +681,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 1
"nbformat_minor": 4
}
2 changes: 1 addition & 1 deletion day01/Python_basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.9.13"
}
},
"nbformat": 4,
Expand Down
21 changes: 10 additions & 11 deletions day01/tasks_for_datatypes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
"outputs": [],
"source": [
"def wwmrl(s):\n",
" #Code Here\n",
" # Code Here\n",
"assert wwmrl(['this', 'is', 'an', 'elementary', 'test', 'example', 'aabbccddeeff']) == 6"
]
},
Expand Down Expand Up @@ -238,9 +238,9 @@
"outputs": [],
"source": [
"\"\"\"Sample Dictionary\"\"\"\n",
"dic1={1:10, 2:20}\n",
"dic2={3:30, 4:40}\n",
"dic3={5:50,6:60}\n",
"dic1 = {1:10, 2:20}\n",
"dic2 = {3:30, 4:40}\n",
"dic3 = {5:50,6:60}\n",
"\"\"\"\"Expected Result : {1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60}\"\"\""
]
},
Expand Down Expand Up @@ -289,8 +289,8 @@
"metadata": {},
"outputs": [],
"source": [
"assert (convert_to_palindrome('AAAACACBA') == 'AACABACAA')\n",
"assert (convert_to_palindrome('AAAACACBA') == 'IMPOSSIBLE')"
"assert (convert_to_palindrome('AAAACACBA') == convert_to_palindrome('AAAACACBA')[::-1])\n",
"assert (convert_to_palindrome('AAAACADBA') == 'IMPOSSIBLE')"
]
},
{
Expand All @@ -313,7 +313,7 @@
"metadata": {},
"outputs": [],
"source": [
"assert (get_unique_elements([1, 2, 2, 'a', 'a', 'a', 'g', 5]) == [1, 2, 'a', 'g', 5])"
"assert (set(get_unique_elements([1, 2, 2, 'a', 'a', 'a', 'g', 5])) == set([1, 2, 'a', 'g', 5]))"
]
},
{
Expand Down Expand Up @@ -428,7 +428,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.4 64-bit",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -442,15 +442,14 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.4"
"version": "3.9.13"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
Loading