Skip to content

Instantly share code, notes, and snippets.

@kantale
Last active February 9, 2023 08:03
Show Gist options
  • Save kantale/3b30f822832303e8b146bdcdae722e0e to your computer and use it in GitHub Desktop.
Save kantale/3b30f822832303e8b146bdcdae722e0e to your computer and use it in GitHub Desktop.
lesson1
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "e6953391",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"3+5"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "376bd6fa",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"196788443871352670102184767382826311693053635858544285540803828608"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"6262456345643564356345634563456 * 31423523456294785629347562934756293"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "d47aab9a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"10//3\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "49a632ab",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.3333333333333335"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"10/3"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "3cc17ae4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"10 % 3"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "0d4be9cc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5.0"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"10/2"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "c3cb688a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"10.0"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"10.0"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "7c57db67",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"9"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"3**2"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "87998c1c",
"metadata": {},
"outputs": [
{
"ename": "ZeroDivisionError",
"evalue": "division by zero",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mZeroDivisionError\u001b[0m Traceback (most recent call last)",
"Input \u001b[1;32mIn [9]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;241;43m1\u001b[39;49m\u001b[38;5;241;43m/\u001b[39;49m\u001b[38;5;241;43m0\u001b[39;49m\n",
"\u001b[1;31mZeroDivisionError\u001b[0m: division by zero"
]
}
],
"source": [
"1/0"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "598a9ce9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'mitsos'"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos'"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "33bc43d5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'helloworld'"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'hello' + 'world'"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "1224d8df",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'hellohellohellohellohellohellohellohellohellohello'"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'hello' * 10"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "88ee0baa",
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "unsupported operand type(s) for -: 'str' and 'str'",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)",
"Input \u001b[1;32mIn [13]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43masd\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m-\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43masdfsad\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\n",
"\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for -: 'str' and 'str'"
]
}
],
"source": [
"'asd' - 'asdfsad'"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "a31ac9ef",
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "EOL while scanning string literal (1793345089.py, line 1)",
"output_type": "error",
"traceback": [
"\u001b[1;36m Input \u001b[1;32mIn [14]\u001b[1;36m\u001b[0m\n\u001b[1;33m 'asdf' / 'asdfsadf\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m EOL while scanning string literal\n"
]
}
],
"source": [
"'asdf' / 'asdfsadf"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "0e4d0af2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"6"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len('mitsos')"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "aa2356f7",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(' mitsos ')"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "0df83226",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len('')"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "3b181bc2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'mitsos'"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'' + 'mitsos'"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "ef47019f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"9"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len('afsdgzlfg')"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "c4d705df",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos'.count('s')"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "5bcf3911",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos'.count('os')"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "249c30bb",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos'.index('t')"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "6948d635",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos'.index('m')"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "62be8c23",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'MITSOS'"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos'.upper()"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "69b37d14",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Μήτσος'"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'Μήτσος'"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "6b981254",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'sdfgsdfg'"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'sdfgsdfg'"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "478f58c6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'sdfs'"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"sdfs\""
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "bd9e2ad5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'kjgeafgsjhfgkjfh'"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'''kjgeafgsjhfgkjfh'''"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "d4fe6fe7",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'asfzsdffasdfasdf'"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"asfzsdffasdfasdf\""
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "2edda1f6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'sdgsdfgsdfg'"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"\"\"sdgsdfgsdfg\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "7aa2812d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\"this is my dog's face\""
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"this is my dog's face\""
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "76d966a5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'he said \"thank you\"'"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'he said \"thank you\"'"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "5cf8c2b5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"' this is my dog\\'s face he said \"thank you\" '"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"''' this is my dog's face he said \"thank you\" '''"
]
},
{
"cell_type": "code",
"execution_count": 35,
"id": "9d22b9d6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"sdfgsdfg\n"
]
}
],
"source": [
"print ('sdfgsdfg')"
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "ada86a07",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2 3 4 mitsos\n"
]
}
],
"source": [
"print( 2,3,4,'mitsos' )"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "f17c8ac3",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" the answer is 5 \n"
]
}
],
"source": [
"print (' the answer is 5 ')"
]
},
{
"cell_type": "code",
"execution_count": 39,
"id": "f11e3f19",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" the answer is \n",
" 5 \n"
]
}
],
"source": [
"print (' the answer is \\n 5 ')"
]
},
{
"cell_type": "code",
"execution_count": 40,
"id": "c2669771",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" the answer is\t5\n"
]
}
],
"source": [
"print (' the answer is\\t5')"
]
},
{
"cell_type": "code",
"execution_count": 41,
"id": "29d20ee3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'\\nz,jdhfdskaj faga\\nsd\\ngs\\ngs\\nfgs\\ndg\\nsdf\\n'"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'''\n",
"z,jdhfdskaj faga\n",
"sd\n",
"gs\n",
"gs\n",
"fgs\n",
"dg\n",
"sdf\n",
"'''"
]
},
{
"cell_type": "code",
"execution_count": 42,
"id": "ac81e213",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"z,jdhfdskaj faga\n",
"sd\n",
"gs\n",
"gs\n",
"fgs\n",
"dg\n",
"sdf\n",
"\n"
]
}
],
"source": [
"print ('''\n",
"z,jdhfdskaj faga\n",
"sd\n",
"gs\n",
"gs\n",
"fgs\n",
"dg\n",
"sdf\n",
"''')"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "6586c182",
"metadata": {},
"outputs": [],
"source": [
"# sfkdghlsjkfghsldkjgh"
]
},
{
"cell_type": "code",
"execution_count": 44,
"id": "2d2eb0b3",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"sadsad\n"
]
}
],
"source": [
"print ('sadsad') # this prints ..."
]
},
{
"cell_type": "code",
"execution_count": 45,
"id": "87e3b513",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"2^3 # This is not exponential. This is \"bitwise XOR\""
]
},
{
"cell_type": "code",
"execution_count": 46,
"id": "94c8a71e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"2**3"
]
},
{
"cell_type": "code",
"execution_count": 47,
"id": "07c8c1db",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"13.0"
]
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"10 + 6 / 2"
]
},
{
"cell_type": "code",
"execution_count": 48,
"id": "37d287a0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"13.0"
]
},
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"10 + (6 / 2)"
]
},
{
"cell_type": "code",
"execution_count": 49,
"id": "229d283e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The Zen of Python, by Tim Peters\n",
"\n",
"Beautiful is better than ugly.\n",
"Explicit is better than implicit.\n",
"Simple is better than complex.\n",
"Complex is better than complicated.\n",
"Flat is better than nested.\n",
"Sparse is better than dense.\n",
"Readability counts.\n",
"Special cases aren't special enough to break the rules.\n",
"Although practicality beats purity.\n",
"Errors should never pass silently.\n",
"Unless explicitly silenced.\n",
"In the face of ambiguity, refuse the temptation to guess.\n",
"There should be one-- and preferably only one --obvious way to do it.\n",
"Although that way may not be obvious at first unless you're Dutch.\n",
"Now is better than never.\n",
"Although never is often better than *right* now.\n",
"If the implementation is hard to explain, it's a bad idea.\n",
"If the implementation is easy to explain, it may be a good idea.\n",
"Namespaces are one honking great idea -- let's do more of those!\n"
]
}
],
"source": [
"import this"
]
},
{
"cell_type": "code",
"execution_count": 50,
"id": "882c3c7c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1"
]
},
{
"cell_type": "code",
"execution_count": 51,
"id": "6b0b7e03",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 51,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"0"
]
},
{
"cell_type": "code",
"execution_count": 52,
"id": "8d4a20cf",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"True"
]
},
{
"cell_type": "code",
"execution_count": 53,
"id": "8f3b39f5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 53,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1"
]
},
{
"cell_type": "code",
"execution_count": 54,
"id": "c73d1c7f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"True + True"
]
},
{
"cell_type": "code",
"execution_count": 55,
"id": "91288c24",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 55,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"0"
]
},
{
"cell_type": "code",
"execution_count": 56,
"id": "c1bc9117",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 56,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"False"
]
},
{
"cell_type": "code",
"execution_count": 57,
"id": "546ae49d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"False * 10"
]
},
{
"cell_type": "code",
"execution_count": 58,
"id": "517a051a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'helloworld'"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'hello' + 'world'"
]
},
{
"cell_type": "code",
"execution_count": 59,
"id": "d7679200",
"metadata": {},
"outputs": [],
"source": [
"#'hello' 'world'"
]
},
{
"cell_type": "code",
"execution_count": 60,
"id": "0c540fb7",
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (2783745445.py, line 1)",
"output_type": "error",
"traceback": [
"\u001b[1;36m Input \u001b[1;32mIn [60]\u001b[1;36m\u001b[0m\n\u001b[1;33m 3 3\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
]
}
],
"source": [
"3 3"
]
},
{
"cell_type": "code",
"execution_count": 61,
"id": "27b906da",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'helloworld'"
]
},
"execution_count": 61,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'hello' 'world'"
]
},
{
"cell_type": "code",
"execution_count": 62,
"id": "c9aa79f5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3"
]
},
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1 + 2"
]
},
{
"cell_type": "code",
"execution_count": 63,
"id": "08b83131",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3"
]
},
"execution_count": 63,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1+2"
]
},
{
"cell_type": "code",
"execution_count": 64,
"id": "a1f76aa4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5 > 3"
]
},
{
"cell_type": "code",
"execution_count": 65,
"id": "956338a6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"11"
]
},
"execution_count": 65,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(5 > 3) + 10"
]
},
{
"cell_type": "code",
"execution_count": 66,
"id": "7d72ab59",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 66,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5 < 3"
]
},
{
"cell_type": "code",
"execution_count": 67,
"id": "0f30d5d5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 67,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5 < 5"
]
},
{
"cell_type": "code",
"execution_count": 68,
"id": "e063e3f4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 68,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5 > 5"
]
},
{
"cell_type": "code",
"execution_count": 69,
"id": "ae075c0d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 69,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5 <= 5 "
]
},
{
"cell_type": "code",
"execution_count": 70,
"id": "d6c16502",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 70,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5 >= 5"
]
},
{
"cell_type": "code",
"execution_count": 71,
"id": "f110c5f9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 71,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'maria' > 'mitsos'"
]
},
{
"cell_type": "code",
"execution_count": 72,
"id": "0ee1fa50",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 72,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mariasdfghsdkfjghslkdfjghlskdfjgh' > 'mitsosdflghj'"
]
},
{
"cell_type": "code",
"execution_count": 73,
"id": "6d2cedf9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 73,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'maria' < 'mitsos'"
]
},
{
"cell_type": "code",
"execution_count": 74,
"id": "bd1cf67e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 74,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'maria' < 'maria123'"
]
},
{
"cell_type": "code",
"execution_count": 75,
"id": "422d3f49",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 75,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'' < 'asdfasf'"
]
},
{
"cell_type": "code",
"execution_count": 77,
"id": "da0c57ba",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 77,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'m' > '1234'"
]
},
{
"cell_type": "code",
"execution_count": 78,
"id": "459d0833",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 78,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5 == 5"
]
},
{
"cell_type": "code",
"execution_count": 79,
"id": "6c48f4d8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 79,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos' == 'mitsos'"
]
},
{
"cell_type": "code",
"execution_count": 80,
"id": "40dfbd88",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 80,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'5' == 5"
]
},
{
"cell_type": "code",
"execution_count": 81,
"id": "f73164b4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"6"
]
},
"execution_count": 81,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5 + 1"
]
},
{
"cell_type": "code",
"execution_count": 82,
"id": "6c32a0c5",
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "can only concatenate str (not \"int\") to str",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)",
"Input \u001b[1;32mIn [82]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m5\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\n",
"\u001b[1;31mTypeError\u001b[0m: can only concatenate str (not \"int\") to str"
]
}
],
"source": [
"'5' + 1"
]
},
{
"cell_type": "code",
"execution_count": 83,
"id": "da11ebcb",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"6.3"
]
},
"execution_count": 83,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5+1.3"
]
},
{
"cell_type": "code",
"execution_count": 84,
"id": "dc0f9526",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 84,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1 == 1"
]
},
{
"cell_type": "code",
"execution_count": 85,
"id": "8ccb5dc9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 85,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1 != 2"
]
},
{
"cell_type": "code",
"execution_count": 86,
"id": "e97a1225",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 86,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"0 != False"
]
},
{
"cell_type": "code",
"execution_count": 87,
"id": "1c5f82bc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 87,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"0 == False"
]
},
{
"cell_type": "code",
"execution_count": 88,
"id": "ec7bc074",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 88,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"2 < 4 < 10"
]
},
{
"cell_type": "code",
"execution_count": 89,
"id": "44637bc3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 89,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5 > 10 > 20"
]
},
{
"cell_type": "code",
"execution_count": 91,
"id": "5d1f434a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 91,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5 == 6 == 5"
]
},
{
"cell_type": "code",
"execution_count": 92,
"id": "dbbb0e5c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 92,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"4456745674\" < \"5\""
]
},
{
"cell_type": "code",
"execution_count": 93,
"id": "6ff26106",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 93,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"True"
]
},
{
"cell_type": "code",
"execution_count": 94,
"id": "81a0db94",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 94,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"False"
]
},
{
"cell_type": "code",
"execution_count": 95,
"id": "fd896d68",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 95,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"True and True"
]
},
{
"cell_type": "code",
"execution_count": 96,
"id": "66e80083",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 96,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"False and True"
]
},
{
"cell_type": "code",
"execution_count": 97,
"id": "714cf23e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 97,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"True and False"
]
},
{
"cell_type": "code",
"execution_count": 98,
"id": "d41099a9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 98,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"False and False"
]
},
{
"cell_type": "code",
"execution_count": 99,
"id": "f3b86353",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 101,
"id": "a47f228e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 101,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x = 150\n",
"x>0 and x<100"
]
},
{
"cell_type": "code",
"execution_count": 102,
"id": "5857f9a6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 102,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"0<x<100"
]
},
{
"cell_type": "code",
"execution_count": 106,
"id": "6fcecf02",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 106,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# θα παω για ψώνια αν κάνει καλό καιρό ή βρω παρέα\n",
"False or True"
]
},
{
"cell_type": "code",
"execution_count": 107,
"id": "95fd0cf4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 107,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"True or False"
]
},
{
"cell_type": "code",
"execution_count": 108,
"id": "739fc86e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 108,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"True or True"
]
},
{
"cell_type": "code",
"execution_count": 109,
"id": "91579efa",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 109,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"False or False"
]
},
{
"cell_type": "code",
"execution_count": 111,
"id": "eb776849",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 111,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x = 150\n",
"x<0 or x>100"
]
},
{
"cell_type": "code",
"execution_count": 112,
"id": "7c42dfea",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 112,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"not True"
]
},
{
"cell_type": "code",
"execution_count": 113,
"id": "69efc876",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 113,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"not False"
]
},
{
"cell_type": "code",
"execution_count": 114,
"id": "f8e15a0b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 114,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"not 4>2"
]
},
{
"cell_type": "code",
"execution_count": 119,
"id": "1729ace3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-2"
]
},
"execution_count": 119,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"4 and (~ True)"
]
},
{
"cell_type": "code",
"execution_count": 120,
"id": "7c632d7f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 120,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"True & False"
]
},
{
"cell_type": "code",
"execution_count": 121,
"id": "093b722e",
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (2260279045.py, line 1)",
"output_type": "error",
"traceback": [
"\u001b[1;36m Input \u001b[1;32mIn [121]\u001b[1;36m\u001b[0m\n\u001b[1;33m 4 and (! True)\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
]
}
],
"source": [
"4 and (! True)"
]
},
{
"cell_type": "code",
"execution_count": 122,
"id": "6068fd33",
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (3045828773.py, line 1)",
"output_type": "error",
"traceback": [
"\u001b[1;36m Input \u001b[1;32mIn [122]\u001b[1;36m\u001b[0m\n\u001b[1;33m True False False\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
]
}
],
"source": [
"True False False\n",
"&\n",
"False True True\n",
"-->\n",
"False False False"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "70bf31d7",
"metadata": {},
"outputs": [],
"source": [
"True False False\n",
"and\n",
"False True True\n",
"-->\n",
"True"
]
},
{
"cell_type": "code",
"execution_count": 123,
"id": "0b11e924",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5"
]
},
"execution_count": 123,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"int('5')"
]
},
{
"cell_type": "code",
"execution_count": 124,
"id": "54771e40",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"6"
]
},
"execution_count": 124,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"int('5') + 1"
]
},
{
"cell_type": "code",
"execution_count": 125,
"id": "5be60071",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'8'"
]
},
"execution_count": 125,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"str(8)"
]
},
{
"cell_type": "code",
"execution_count": 126,
"id": "dd8f4da2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'88888888'"
]
},
"execution_count": 126,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"str(8) * 8"
]
},
{
"cell_type": "code",
"execution_count": 127,
"id": "4c982dd5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 127,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bool('Mitsos')"
]
},
{
"cell_type": "code",
"execution_count": 128,
"id": "0b3e229c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 128,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bool('')"
]
},
{
"cell_type": "code",
"execution_count": 129,
"id": "9a3e7d97",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 129,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bool(' ')"
]
},
{
"cell_type": "code",
"execution_count": 130,
"id": "6140e16f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 130,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bool(5)"
]
},
{
"cell_type": "code",
"execution_count": 131,
"id": "75b81e07",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 131,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bool(1)"
]
},
{
"cell_type": "code",
"execution_count": 132,
"id": "5310ad96",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 132,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bool(5-5)"
]
},
{
"cell_type": "code",
"execution_count": 133,
"id": "2f0b8c30",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 133,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bool(1.2)"
]
},
{
"cell_type": "code",
"execution_count": 134,
"id": "f561b3c8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 134,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bool(0.5)"
]
},
{
"cell_type": "code",
"execution_count": 135,
"id": "be28e584",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 135,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bool(0.0000000000000000000000001)"
]
},
{
"cell_type": "code",
"execution_count": 136,
"id": "96acd24e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 136,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bool(0.0)"
]
},
{
"cell_type": "code",
"execution_count": 137,
"id": "72685567",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'kostas'"
]
},
"execution_count": 137,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos' and 'kostas'"
]
},
{
"cell_type": "code",
"execution_count": 138,
"id": "80239e51",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 138,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos' and 'kostas' and False and 'Maria'"
]
},
{
"cell_type": "code",
"execution_count": 139,
"id": "0ff5d993",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"''"
]
},
"execution_count": 139,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos' and 'kostas' and '' and 'Maria'"
]
},
{
"cell_type": "code",
"execution_count": 140,
"id": "17096aae",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 140,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"False and 1/0"
]
},
{
"cell_type": "code",
"execution_count": 141,
"id": "e66cc5dd",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 141,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bool('')"
]
},
{
"cell_type": "code",
"execution_count": 142,
"id": "ede4b7ed",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'mitsos'"
]
},
"execution_count": 142,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos' or 'kostas'"
]
},
{
"cell_type": "code",
"execution_count": 143,
"id": "9487c39f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'mitsos'"
]
},
"execution_count": 143,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos' or 1/0"
]
},
{
"cell_type": "code",
"execution_count": 144,
"id": "9c4615ad",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5.5"
]
},
"execution_count": 144,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"False or '' or 0 or 5.5 or 'mitsos'"
]
},
{
"cell_type": "code",
"execution_count": 145,
"id": "160a34f8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 145,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bool('mitsos')"
]
},
{
"cell_type": "code",
"execution_count": 146,
"id": "4271bea0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 146,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"not not 'mitsos'"
]
},
{
"cell_type": "code",
"execution_count": 147,
"id": "e44f4910",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'SDFASDFAS'"
]
},
"execution_count": 147,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'sdfasdfas'.upper()"
]
},
{
"cell_type": "code",
"execution_count": 152,
"id": "b1bbb519",
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "str.lower() takes no arguments (1 given)",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)",
"Input \u001b[1;32mIn [152]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mSADFSADF\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlower\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43ms\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n",
"\u001b[1;31mTypeError\u001b[0m: str.lower() takes no arguments (1 given)"
]
}
],
"source": [
"'SADFSADF'.lower('s')"
]
},
{
"cell_type": "code",
"execution_count": 154,
"id": "17ec788c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'sdfg'"
]
},
"execution_count": 154,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"' sdfg '.strip()"
]
},
{
"cell_type": "code",
"execution_count": 156,
"id": "38e979e5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'mit+o+'"
]
},
"execution_count": 156,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos'.replace('s', '+')"
]
},
{
"cell_type": "code",
"execution_count": 157,
"id": "4646ff9e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'mitSoS'"
]
},
"execution_count": 157,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos'.replace('s', 'S')"
]
},
{
"cell_type": "code",
"execution_count": 151,
"id": "b63921ff",
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'lower' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"Input \u001b[1;32mIn [151]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mlower\u001b[49m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msdfgsdfgdf\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
"\u001b[1;31mNameError\u001b[0m: name 'lower' is not defined"
]
}
],
"source": [
"lower('sdfgsdfgdf')"
]
},
{
"cell_type": "code",
"execution_count": 158,
"id": "85160482",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'m'"
]
},
"execution_count": 158,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"'mitsos'[0]\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 159,
"id": "02fd9cfd",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'i'"
]
},
"execution_count": 159,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos'[1]\n"
]
},
{
"cell_type": "code",
"execution_count": 160,
"id": "77157446",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'s'"
]
},
"execution_count": 160,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos'[-1]"
]
},
{
"cell_type": "code",
"execution_count": 161,
"id": "fd2e334f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'o'"
]
},
"execution_count": 161,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'mitsos'[-2]"
]
},
{
"cell_type": "code",
"execution_count": 163,
"id": "1f935065",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'d'"
]
},
"execution_count": 163,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'abcdefghijkl'[3]"
]
},
{
"cell_type": "code",
"execution_count": 167,
"id": "384d440e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'defghij'"
]
},
"execution_count": 167,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'abcdefghijkl'[3:10]"
]
},
{
"cell_type": "code",
"execution_count": 169,
"id": "cbe52a47",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'dfhj'"
]
},
"execution_count": 169,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'abcdefghijkl'[3:10:2]"
]
},
{
"cell_type": "code",
"execution_count": 170,
"id": "2520aaec",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'dgj'"
]
},
"execution_count": 170,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'abcdefghijkl'[3:10:3]"
]
},
{
"cell_type": "code",
"execution_count": 173,
"id": "901541f1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'lk'"
]
},
"execution_count": 173,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'abcdefghijkl'[-1:-3:-1]"
]
},
{
"cell_type": "code",
"execution_count": 174,
"id": "0cc4d08b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'ki'"
]
},
"execution_count": 174,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'abcdefghijkl'[-2:-6:-2]"
]
},
{
"cell_type": "code",
"execution_count": 177,
"id": "50864c54",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'ki'"
]
},
"execution_count": 177,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'abcdefghijkl'[-2:-5:-2]"
]
},
{
"cell_type": "code",
"execution_count": 178,
"id": "6fac4060",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'abcde'"
]
},
"execution_count": 178,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'abcdefghijkl'[:5]"
]
},
{
"cell_type": "code",
"execution_count": 180,
"id": "83fccd6e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'abcde'"
]
},
"execution_count": 180,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'abcdefghijkl'[0:5]"
]
},
{
"cell_type": "code",
"execution_count": 181,
"id": "8e870429",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'fghijkl'"
]
},
"execution_count": 181,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'abcdefghijkl'[5:]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "068e0c09",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 182,
"id": "c5b884fc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'kl'"
]
},
"execution_count": 182,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'abcdefghijkl'[-2::1]"
]
},
{
"cell_type": "code",
"execution_count": 183,
"id": "e9539842",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'kjihgfedcba'"
]
},
"execution_count": 183,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'abcdefghijkl'[-2::-1]"
]
},
{
"cell_type": "code",
"execution_count": 184,
"id": "2fe6de33",
"metadata": {},
"outputs": [
{
"ename": "IndexError",
"evalue": "string index out of range",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)",
"Input \u001b[1;32mIn [184]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mabc\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m3\u001b[39;49m\u001b[43m]\u001b[49m\n",
"\u001b[1;31mIndexError\u001b[0m: string index out of range"
]
}
],
"source": [
"'abc'[3]"
]
},
{
"cell_type": "code",
"execution_count": 185,
"id": "1e0646a7",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'bc'"
]
},
"execution_count": 185,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'abc'[1:2452]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "31be4657",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "7c1785c9",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment