Compare commits

...

3 Commits

Author SHA1 Message Date
20fdb9413d update a1 notebook 2024-01-18 17:48:05 -04:00
3fe5f5a9e3 run config 2024-01-18 17:46:11 -04:00
a62334b3a4 run config 2024-01-18 17:45:59 -04:00
3 changed files with 64 additions and 27 deletions

View File

@ -1,6 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Export A1" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="jupyter-nbconvert.exe &quot;Assignment 1.ipynb&quot; --to webpdf --no-input" />
<option name="SCRIPT_TEXT" value="jupyter-nbconvert.exe &quot;Assignment 1.ipynb&quot; --to webpdf" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />

View File

@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Export A1 No Code" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="jupyter-nbconvert.exe &quot;Assignment 1.ipynb&quot; --to webpdf --no-input" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="powershell.exe" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="false" />
<option name="EXECUTE_SCRIPT_FILE" value="false" />
<envs />
<method v="2" />
</configuration>
</component>

View File

@ -19,16 +19,36 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-01-18T20:59:35.482159200Z",
"start_time": "2024-01-18T20:59:35.470889900Z"
"end_time": "2024-01-18T21:45:24.278399500Z",
"start_time": "2024-01-18T21:45:24.273024200Z"
}
},
"outputs": [],
"source": [
"# util contains functions that make it easier to form strings \n",
"# from languages, and give output that matches with expected \n",
"# output for the homework, (replace empty string with epsilon)\n",
"from util import *"
"# Helper functions\n",
"def get_all_strings_with_a_given_alphabet_and_length(_alphabet, _length):\n",
"\t_strings = ['']\n",
"\tfor itr in range(_length):\n",
"\t\t_string = [s + c for s in _strings for c in _alphabet]\n",
"\t\t_strings += _string\n",
"\n",
"\t# Remove duplicates (set() isn't as nice as it doesn't preserve order, at least for verification purposes)\n",
"\t_strings = list(dict.fromkeys(_strings))\n",
"\treturn _strings\n",
"\n",
"\n",
"def replace_empty_string_with_symbol(_strings):\n",
"\tsymbol = 'ε'\n",
"\tfor itr in range(len(_strings)):\n",
"\t\tif _strings[itr] == '':\n",
"\t\t\t_strings[itr] = symbol\n",
"\treturn _strings\n",
"\n",
"\n",
"def print_strings(_strings):\n",
"\t_strings = replace_empty_string_with_symbol(_strings)\n",
"\t# print(len(strings))\n",
"\tprint(_strings)"
]
},
{
@ -59,8 +79,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-01-18T20:59:35.494611400Z",
"start_time": "2024-01-18T20:59:35.477374Z"
"end_time": "2024-01-18T21:45:24.284569900Z",
"start_time": "2024-01-18T21:45:24.278399500Z"
}
},
"outputs": [
@ -104,8 +124,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-01-18T20:59:35.536014100Z",
"start_time": "2024-01-18T20:59:35.486263100Z"
"end_time": "2024-01-18T21:45:24.288935300Z",
"start_time": "2024-01-18T21:45:24.286415200Z"
}
},
"outputs": [
@ -148,8 +168,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-01-18T20:59:35.536014100Z",
"start_time": "2024-01-18T20:59:35.491094800Z"
"end_time": "2024-01-18T21:45:24.296122800Z",
"start_time": "2024-01-18T21:45:24.289936100Z"
}
},
"outputs": [
@ -190,8 +210,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-01-18T20:59:35.539017300Z",
"start_time": "2024-01-18T20:59:35.497609900Z"
"end_time": "2024-01-18T21:45:24.298113500Z",
"start_time": "2024-01-18T21:45:24.293966900Z"
}
},
"outputs": [
@ -241,8 +261,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-01-18T20:59:35.581083800Z",
"start_time": "2024-01-18T20:59:35.542564Z"
"end_time": "2024-01-18T21:45:24.340947500Z",
"start_time": "2024-01-18T21:45:24.299113600Z"
}
},
"outputs": [
@ -282,8 +302,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-01-18T20:59:35.594528300Z",
"start_time": "2024-01-18T20:59:35.585083400Z"
"end_time": "2024-01-18T21:45:24.341947200Z",
"start_time": "2024-01-18T21:45:24.303632300Z"
}
},
"outputs": [
@ -331,8 +351,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-01-18T20:59:35.649706300Z",
"start_time": "2024-01-18T20:59:35.597530600Z"
"end_time": "2024-01-18T21:45:24.341947200Z",
"start_time": "2024-01-18T21:45:24.307343300Z"
}
},
"outputs": [
@ -392,8 +412,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-01-18T20:59:35.650706300Z",
"start_time": "2024-01-18T20:59:35.603524100Z"
"end_time": "2024-01-18T21:45:24.342947100Z",
"start_time": "2024-01-18T21:45:24.314341500Z"
}
},
"outputs": [
@ -461,8 +481,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-01-18T20:59:35.652706Z",
"start_time": "2024-01-18T20:59:35.612375700Z"
"end_time": "2024-01-18T21:45:24.342947100Z",
"start_time": "2024-01-18T21:45:24.317844500Z"
}
},
"outputs": [
@ -511,8 +531,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-01-18T20:59:35.691666Z",
"start_time": "2024-01-18T20:59:35.656707400Z"
"end_time": "2024-01-18T21:45:24.342947100Z",
"start_time": "2024-01-18T21:45:24.323363100Z"
}
},
"outputs": [