Add a3 skeleton
This commit is contained in:
parent
1e91ba5ba6
commit
d4f41fbd44
51
Assignment 3.ipynb
Normal file
51
Assignment 3.ipynb
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "initial_id",
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from automata.fa.dfa import DFA\n",
|
||||
"\n",
|
||||
"# DFA which matches all binary strings ending in an odd number of '1's\n",
|
||||
"my_dfa = DFA(\n",
|
||||
"\tstates={'q0', 'q1', 'q2'},\n",
|
||||
"\tinput_symbols={'0', '1'},\n",
|
||||
"\ttransitions={\n",
|
||||
"\t\t'q0': {'0': 'q0', '1': 'q1'},\n",
|
||||
"\t\t'q1': {'0': 'q0', '1': 'q2'},\n",
|
||||
"\t\t'q2': {'0': 'q2', '1': 'q1'}\n",
|
||||
"\t},\n",
|
||||
"\tinitial_state='q0',\n",
|
||||
"\tfinal_states={'q1'}\n",
|
||||
")\n",
|
||||
"my_dfa.show_diagram()"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
Loading…
Reference in New Issue
Block a user