Skip to main content

Automata Practical Exam – Section 5

Student Info

  • Section Number: 5
  • Tasks Solved:
    1. DFA that accepts binary strings containing the substring 101
    2. Turing Machine that recognizes binary numbers divisible by 3

Project Structure

automata_practical_exam_<4549>/
│
├── automata/                    #  Python package root
│   ├── __init__.py              # makes this a package
│   ├── dfa.py                   # DFA implementation
│   └── turing_machine.py        # Turing Machine implementation
│
├── tests/                       #  Unit tests
│   ├── test_dfa.py
│   └── test_turing_machine.py
│
├── README.md                    #  this file
└── setup.py                     #  package metadata


-------------------------------------------------
>>>Installation
# from project root
pip install -e .
Installs the package in “editable” mode so you can modify code and see changes immediately.

>>>Usage
1. Import and run the DFA
from automata.dfa import DFA

dfa = DFA()
print(dfa.accepts("010101"))   # True
print(dfa.accepts("0100"))     # False


------------------------------------------------

2. Import and run the Turing Machine
from automata.turing_machine import TuringMachine

tm = TuringMachine("110")      # binary 6
print(tm.run())                # True (6 divisible by 3)

tm2 = TuringMachine("101")     # binary 5
print(tm2.run())               # False (5 not divisible by 3)


------------------------------------------------
 >>>>>Running Tests
 pip install pytest
pytest tests/


Or run individual test files:
python -m pytest tests/test_dfa.py
python -m pytest tests/test_turing_machine.py

Metadata

Release files for automata-practical-mohamedaz 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for automata-practical-mohamedaz 0.1
File Size Uploaded Provenance Actions
automata_practical_mohamedaz-0.1.tar.gz 2.9 kB Without provenance Details for automata_practical_mohamedaz-0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for automata-practical-mohamedaz 0.1
File Interpreter ABI Platform Actions
automata_practical_mohamedaz-0.1-py3-none-any.whl Python 3 none any Details for automata_practical_mohamedaz-0.1-py3-none-any.whl

Total release size: 6.0 kB

Release files / automata_practical_mohamedaz-0.1.tar.gz

Download URL automata_practical_mohamedaz-0.1.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
92e1350b14335e99d2b4bbf32999472875223a53d23620db95ddac38b982eb03
BLAKE2b-256 checksum
How to use checksums
289727fc34a83decc3758d90d609403da4e83f559ee3b9a4d0edb6f2595c7050
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Release files / automata_practical_mohamedaz-0.1-py3-none-any.whl

Download URL automata_practical_mohamedaz-0.1-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6329732e4651c2010df4ee41123b78f97f207303de52c2a59c09647cf9088cb0
BLAKE2b-256 checksum
How to use checksums
5ddb21b55e0e05ca3e603823eb97592b8e79016be0a0f658fdf60749e316b6bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Security for automata-practical-mohamedaz 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page