Compare commits

..

No commits in common. "20fdb9413d0cce8d464dea92c7a146744fba0f1c" and "65f5adc2aca1ced0a35f3b2b82ad9296db7d9f4e" have entirely different histories.

3 changed files with 27 additions and 64 deletions

View File

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

View File

@ -1,17 +0,0 @@
<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,36 +19,16 @@
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"ExecuteTime": { "ExecuteTime": {
"end_time": "2024-01-18T21:45:24.278399500Z", "end_time": "2024-01-18T20:59:35.482159200Z",
"start_time": "2024-01-18T21:45:24.273024200Z" "start_time": "2024-01-18T20:59:35.470889900Z"
} }
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"# Helper functions\n", "# util contains functions that make it easier to form strings \n",
"def get_all_strings_with_a_given_alphabet_and_length(_alphabet, _length):\n", "# from languages, and give output that matches with expected \n",
"\t_strings = ['']\n", "# output for the homework, (replace empty string with epsilon)\n",
"\tfor itr in range(_length):\n", "from util import *"
"\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)"
] ]
}, },
{ {
@ -79,8 +59,8 @@
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"ExecuteTime": { "ExecuteTime": {
"end_time": "2024-01-18T21:45:24.284569900Z", "end_time": "2024-01-18T20:59:35.494611400Z",
"start_time": "2024-01-18T21:45:24.278399500Z" "start_time": "2024-01-18T20:59:35.477374Z"
} }
}, },
"outputs": [ "outputs": [
@ -124,8 +104,8 @@
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"ExecuteTime": { "ExecuteTime": {
"end_time": "2024-01-18T21:45:24.288935300Z", "end_time": "2024-01-18T20:59:35.536014100Z",
"start_time": "2024-01-18T21:45:24.286415200Z" "start_time": "2024-01-18T20:59:35.486263100Z"
} }
}, },
"outputs": [ "outputs": [
@ -168,8 +148,8 @@
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"ExecuteTime": { "ExecuteTime": {
"end_time": "2024-01-18T21:45:24.296122800Z", "end_time": "2024-01-18T20:59:35.536014100Z",
"start_time": "2024-01-18T21:45:24.289936100Z" "start_time": "2024-01-18T20:59:35.491094800Z"
} }
}, },
"outputs": [ "outputs": [
@ -210,8 +190,8 @@
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"ExecuteTime": { "ExecuteTime": {
"end_time": "2024-01-18T21:45:24.298113500Z", "end_time": "2024-01-18T20:59:35.539017300Z",
"start_time": "2024-01-18T21:45:24.293966900Z" "start_time": "2024-01-18T20:59:35.497609900Z"
} }
}, },
"outputs": [ "outputs": [
@ -261,8 +241,8 @@
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"ExecuteTime": { "ExecuteTime": {
"end_time": "2024-01-18T21:45:24.340947500Z", "end_time": "2024-01-18T20:59:35.581083800Z",
"start_time": "2024-01-18T21:45:24.299113600Z" "start_time": "2024-01-18T20:59:35.542564Z"
} }
}, },
"outputs": [ "outputs": [
@ -302,8 +282,8 @@
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"ExecuteTime": { "ExecuteTime": {
"end_time": "2024-01-18T21:45:24.341947200Z", "end_time": "2024-01-18T20:59:35.594528300Z",
"start_time": "2024-01-18T21:45:24.303632300Z" "start_time": "2024-01-18T20:59:35.585083400Z"
} }
}, },
"outputs": [ "outputs": [
@ -351,8 +331,8 @@
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"ExecuteTime": { "ExecuteTime": {
"end_time": "2024-01-18T21:45:24.341947200Z", "end_time": "2024-01-18T20:59:35.649706300Z",
"start_time": "2024-01-18T21:45:24.307343300Z" "start_time": "2024-01-18T20:59:35.597530600Z"
} }
}, },
"outputs": [ "outputs": [
@ -412,8 +392,8 @@
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"ExecuteTime": { "ExecuteTime": {
"end_time": "2024-01-18T21:45:24.342947100Z", "end_time": "2024-01-18T20:59:35.650706300Z",
"start_time": "2024-01-18T21:45:24.314341500Z" "start_time": "2024-01-18T20:59:35.603524100Z"
} }
}, },
"outputs": [ "outputs": [
@ -481,8 +461,8 @@
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"ExecuteTime": { "ExecuteTime": {
"end_time": "2024-01-18T21:45:24.342947100Z", "end_time": "2024-01-18T20:59:35.652706Z",
"start_time": "2024-01-18T21:45:24.317844500Z" "start_time": "2024-01-18T20:59:35.612375700Z"
} }
}, },
"outputs": [ "outputs": [
@ -531,8 +511,8 @@
"metadata": { "metadata": {
"collapsed": false, "collapsed": false,
"ExecuteTime": { "ExecuteTime": {
"end_time": "2024-01-18T21:45:24.342947100Z", "end_time": "2024-01-18T20:59:35.691666Z",
"start_time": "2024-01-18T21:45:24.323363100Z" "start_time": "2024-01-18T20:59:35.656707400Z"
} }
}, },
"outputs": [ "outputs": [