PolStringConvertor
PolStringConvertor is a Python package that provides utilities to convert infix expressions into postfix and prefix forms, and to evaluate postfix expressions. It also includes validation of infix expressions.
Features
- Validate infix expressions for proper operator placement and balanced parentheses.
- Convert infix expressions to postfix notation.
- Convert infix expressions to prefix notation.
- Evaluate postfix expressions.
Installation
To install the package, use pip:
pip install PolStringConvertor
This package requires the StrTokenizer package version 1.1.0 to function properly. It will be installed automatically when you install PolStringConvertor.
Usage
Here’s how to use the main features of the package:
1. Validate an Infix Expression
from PolStringConvertor import isExpressionValid
expression = "(a+b)*c"
print(isExpressionValid(expression)) # Returns True or False
2. Convert Infix to Postfix
from PolStringConvertor import infixToPostfix
expression = "(a+b)*c"
postfix = infixToPostfix(expression)
print(postfix) # Output: ['a', 'b', '+', 'c', '*']
3. Convert Infix to Prefix
from PolStringConvertor import infixToPrefix
expression = "(a+b)*c"
prefix = infixToPrefix(expression)
print(prefix) # Output: ['*', '+', 'a', 'b', 'c']
4. Evaluate a Postfix Expression
from PolStringConvertor import evaluatePostfixExpression
postfix = ['3', '4', '+', '2', '*', '7', '/']
result = evaluatePostfixExpression(postfix)
print(result) # Output: 2.0
5. Import All Functions at once
from PolStringConvertor import *
expression = "(a+b)*c"
print(isExpressionValid(expression)) # Returns True or False
postfix = infixToPostfix(expression)
print(postfix) # Output: ['a', 'b', '+', 'c', '*']
prefix = infixToPrefix(expression)
print(prefix) # Output: ['*', '+', 'a', 'b', 'c']
postfix = ['3', '4', '+', '2', '*', '7', '/']
result = evaluatePostfixExpression(postfix)
print(result) # Output: 2.0
You can install the PolStringConvertor package from PyPI:
Install PolStringConvertor from PyPI
Source Code:
License
This project is licensed under the MIT License.
Metadata
Release files for PolStringConvertor 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| polstringconvertor-1.0.0.tar.gz | 4.1 kB | Without provenance | Details for polstringconvertor-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| PolStringConvertor-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for PolStringConvertor-1.0.0-py3-none-any.whl |
Total release size: 8.8 kB
Release files / polstringconvertor-1.0.0.tar.gz
| Download URL | polstringconvertor-1.0.0.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bdd93c5178fd06419a22726c501a071550b0c2dcd7d0031272338f1425943a2c
|
|
BLAKE2b-256 checksum How to use checksums |
5fcf11a22e37c85169fec6c17928b1ae6a61e6f3a5570be8a1e989d13a78d3ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / PolStringConvertor-1.0.0-py3-none-any.whl
| Download URL | PolStringConvertor-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f1efc56c70a1cc69ad19345a67390bb1dfbace55c0b50341c0b306088fb8a08a
|
|
BLAKE2b-256 checksum How to use checksums |
ff4d0eba76ed4058d1e26234d177fb570b0f93a558cd6d1dfb6d03edf939be52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Security for PolStringConvertor 1.0.0
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.