ToolVerse 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- toolverse-1.2.0/LICENSE +22 -0
- toolverse-1.2.0/PKG-INFO +198 -0
- toolverse-1.2.0/README.md +157 -0
- toolverse-1.2.0/pyproject.toml +40 -0
- toolverse-1.2.0/setup.cfg +4 -0
- toolverse-1.2.0/setup.py +8 -0
- toolverse-1.2.0/src/ToolVerse/__init__.py +25 -0
- toolverse-1.2.0/src/ToolVerse/calculator.py +188 -0
- toolverse-1.2.0/src/ToolVerse/conversion_tools.py +111 -0
- toolverse-1.2.0/src/ToolVerse/date_time_tools.py +75 -0
- toolverse-1.2.0/src/ToolVerse/file_tools.py +86 -0
- toolverse-1.2.0/src/ToolVerse/number_tools.py +67 -0
- toolverse-1.2.0/src/ToolVerse/password_tools.py +88 -0
- toolverse-1.2.0/src/ToolVerse/random_tools.py +55 -0
- toolverse-1.2.0/src/ToolVerse/string_tools.py +47 -0
- toolverse-1.2.0/src/ToolVerse/student_tools.py +169 -0
- toolverse-1.2.0/src/ToolVerse/system_tools.py +155 -0
- toolverse-1.2.0/src/ToolVerse.egg-info/PKG-INFO +198 -0
- toolverse-1.2.0/src/ToolVerse.egg-info/SOURCES.txt +30 -0
- toolverse-1.2.0/src/ToolVerse.egg-info/dependency_links.txt +1 -0
- toolverse-1.2.0/src/ToolVerse.egg-info/requires.txt +1 -0
- toolverse-1.2.0/src/ToolVerse.egg-info/top_level.txt +1 -0
- toolverse-1.2.0/tests/test_calculator_module.py +9 -0
- toolverse-1.2.0/tests/test_conversion_tools_module.py +9 -0
- toolverse-1.2.0/tests/test_date_time_tools_module.py +12 -0
- toolverse-1.2.0/tests/test_file_tools_module.py +41 -0
- toolverse-1.2.0/tests/test_number_tools_module.py +12 -0
- toolverse-1.2.0/tests/test_password_tools_module.py +11 -0
- toolverse-1.2.0/tests/test_random_tools_module.py +11 -0
- toolverse-1.2.0/tests/test_string_tools_module.py +15 -0
- toolverse-1.2.0/tests/test_student_tools_module.py +10 -0
- toolverse-1.2.0/tests/test_system_tools_module.py +9 -0
toolverse-1.2.0/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mohammed Ayaz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
toolverse-1.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ToolVerse
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: A personal Python utility library
|
|
5
|
+
Author: Mohammed Ayaz
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Mohammed Ayaz
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
Project-URL: Homepage, https://github.com/gaderjimrs-creator/MyPythonLibrary
|
|
30
|
+
Project-URL: Repository, https://github.com/gaderjimrs-creator/MyPythonLibrary
|
|
31
|
+
Project-URL: Issues, https://github.com/gaderjimrs-creator/MyPythonLibrary/issues
|
|
32
|
+
Keywords: python,utilities,calculator,password-generator,string-tools,file-tools
|
|
33
|
+
Classifier: Programming Language :: Python :: 3
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Operating System :: OS Independent
|
|
36
|
+
Requires-Python: >=3.10
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
License-File: LICENSE
|
|
39
|
+
Requires-Dist: psutil
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# ToolVerse
|
|
43
|
+
|
|
44
|
+
A powerful Python utility library created by **Mohammed Ayaz**.
|
|
45
|
+
This library provides ready-to-use tools for calculations, string operations, number utilities, password generation, file handling, date & time operations, random generators, student management, system utilities, and more.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Features
|
|
50
|
+
|
|
51
|
+
| Module | Description |
|
|
52
|
+
| ---------------- | ----------------------------------------------- |
|
|
53
|
+
| calculator | Mathematical calculations and utility functions |
|
|
54
|
+
| conversion_tools | Unit and measurement conversions |
|
|
55
|
+
| date_time_tools | Date and time utilities |
|
|
56
|
+
| file_tools | File management operations |
|
|
57
|
+
| number_tools | Number-related utilities |
|
|
58
|
+
| password_tools | Password generation and security tools |
|
|
59
|
+
| random_tools | Random values, strings, dates, and passwords |
|
|
60
|
+
| string_tools | String manipulation utilities |
|
|
61
|
+
| student_tools | Student management and reporting system |
|
|
62
|
+
| system_tools | System and OS information utilities |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
Install directly from GitHub:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install git+https://github.com/gaderjimrs-creator/MyPythonLibrary.git
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Or clone the repository:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git clone https://github.com/gaderjimrs-creator/MyPythonLibrary.git
|
|
78
|
+
|
|
79
|
+
cd MyPythonLibrary
|
|
80
|
+
|
|
81
|
+
pip install .
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Usage Examples
|
|
87
|
+
|
|
88
|
+
### Calculator
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from ToolVerse.calculator import MyCalculator
|
|
92
|
+
|
|
93
|
+
calc = MyCalculator()
|
|
94
|
+
|
|
95
|
+
print(calc.add(10, 5))
|
|
96
|
+
print(calc.sub(10, 5))
|
|
97
|
+
print(calc.mul(10, 5))
|
|
98
|
+
print(calc.div(10, 5))
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Password Generator
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from ToolVerse.password_tools import MyPasswordTools
|
|
105
|
+
|
|
106
|
+
pwd = MyPasswordTools()
|
|
107
|
+
|
|
108
|
+
print(pwd.generate_password())
|
|
109
|
+
print(pwd.generate_strong_password())
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### String Tools
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from ToolVerse.string_tools import MyStringTools
|
|
116
|
+
|
|
117
|
+
s = MyStringTools()
|
|
118
|
+
|
|
119
|
+
s.set_string("Hello World")
|
|
120
|
+
|
|
121
|
+
print(s.reverse_string())
|
|
122
|
+
print(s.to_uppercase())
|
|
123
|
+
print(s.count_words())
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Modules Included
|
|
129
|
+
|
|
130
|
+
* calculator
|
|
131
|
+
* conversion_tools
|
|
132
|
+
* date_time_tools
|
|
133
|
+
* file_tools
|
|
134
|
+
* number_tools
|
|
135
|
+
* password_tools
|
|
136
|
+
* random_tools
|
|
137
|
+
* string_tools
|
|
138
|
+
* student_tools
|
|
139
|
+
* system_tools
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Running Tests
|
|
144
|
+
|
|
145
|
+
Run all tests using:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
pytest
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Expected result:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
25 passed
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Project Structure
|
|
160
|
+
|
|
161
|
+
```text
|
|
162
|
+
MyPythonLibrary/
|
|
163
|
+
│
|
|
164
|
+
├── src/
|
|
165
|
+
│ └── MyPythonLibrary/
|
|
166
|
+
│
|
|
167
|
+
├── tests/
|
|
168
|
+
│
|
|
169
|
+
├── README.md
|
|
170
|
+
├── LICENSE
|
|
171
|
+
├── pyproject.toml
|
|
172
|
+
├── pytest.ini
|
|
173
|
+
└── setup.py
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Continuous Integration
|
|
179
|
+
|
|
180
|
+
GitHub Actions automatically runs all tests on every push and pull request.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
This project is licensed under the terms of the LICENSE file included in this repository.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Author
|
|
191
|
+
|
|
192
|
+
**Mohammed Ayaz**
|
|
193
|
+
|
|
194
|
+
GitHub:
|
|
195
|
+
https://github.com/gaderjimrs-creator
|
|
196
|
+
|
|
197
|
+
Python Developer | Open Source Enthusiast
|
|
198
|
+
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# ToolVerse
|
|
2
|
+
|
|
3
|
+
A powerful Python utility library created by **Mohammed Ayaz**.
|
|
4
|
+
This library provides ready-to-use tools for calculations, string operations, number utilities, password generation, file handling, date & time operations, random generators, student management, system utilities, and more.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
| Module | Description |
|
|
11
|
+
| ---------------- | ----------------------------------------------- |
|
|
12
|
+
| calculator | Mathematical calculations and utility functions |
|
|
13
|
+
| conversion_tools | Unit and measurement conversions |
|
|
14
|
+
| date_time_tools | Date and time utilities |
|
|
15
|
+
| file_tools | File management operations |
|
|
16
|
+
| number_tools | Number-related utilities |
|
|
17
|
+
| password_tools | Password generation and security tools |
|
|
18
|
+
| random_tools | Random values, strings, dates, and passwords |
|
|
19
|
+
| string_tools | String manipulation utilities |
|
|
20
|
+
| student_tools | Student management and reporting system |
|
|
21
|
+
| system_tools | System and OS information utilities |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
Install directly from GitHub:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install git+https://github.com/gaderjimrs-creator/MyPythonLibrary.git
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or clone the repository:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
git clone https://github.com/gaderjimrs-creator/MyPythonLibrary.git
|
|
37
|
+
|
|
38
|
+
cd MyPythonLibrary
|
|
39
|
+
|
|
40
|
+
pip install .
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Usage Examples
|
|
46
|
+
|
|
47
|
+
### Calculator
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from ToolVerse.calculator import MyCalculator
|
|
51
|
+
|
|
52
|
+
calc = MyCalculator()
|
|
53
|
+
|
|
54
|
+
print(calc.add(10, 5))
|
|
55
|
+
print(calc.sub(10, 5))
|
|
56
|
+
print(calc.mul(10, 5))
|
|
57
|
+
print(calc.div(10, 5))
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Password Generator
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from ToolVerse.password_tools import MyPasswordTools
|
|
64
|
+
|
|
65
|
+
pwd = MyPasswordTools()
|
|
66
|
+
|
|
67
|
+
print(pwd.generate_password())
|
|
68
|
+
print(pwd.generate_strong_password())
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### String Tools
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from ToolVerse.string_tools import MyStringTools
|
|
75
|
+
|
|
76
|
+
s = MyStringTools()
|
|
77
|
+
|
|
78
|
+
s.set_string("Hello World")
|
|
79
|
+
|
|
80
|
+
print(s.reverse_string())
|
|
81
|
+
print(s.to_uppercase())
|
|
82
|
+
print(s.count_words())
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Modules Included
|
|
88
|
+
|
|
89
|
+
* calculator
|
|
90
|
+
* conversion_tools
|
|
91
|
+
* date_time_tools
|
|
92
|
+
* file_tools
|
|
93
|
+
* number_tools
|
|
94
|
+
* password_tools
|
|
95
|
+
* random_tools
|
|
96
|
+
* string_tools
|
|
97
|
+
* student_tools
|
|
98
|
+
* system_tools
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Running Tests
|
|
103
|
+
|
|
104
|
+
Run all tests using:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
pytest
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Expected result:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
25 passed
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Project Structure
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
MyPythonLibrary/
|
|
122
|
+
│
|
|
123
|
+
├── src/
|
|
124
|
+
│ └── MyPythonLibrary/
|
|
125
|
+
│
|
|
126
|
+
├── tests/
|
|
127
|
+
│
|
|
128
|
+
├── README.md
|
|
129
|
+
├── LICENSE
|
|
130
|
+
├── pyproject.toml
|
|
131
|
+
├── pytest.ini
|
|
132
|
+
└── setup.py
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Continuous Integration
|
|
138
|
+
|
|
139
|
+
GitHub Actions automatically runs all tests on every push and pull request.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
This project is licensed under the terms of the LICENSE file included in this repository.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Author
|
|
150
|
+
|
|
151
|
+
**Mohammed Ayaz**
|
|
152
|
+
|
|
153
|
+
GitHub:
|
|
154
|
+
https://github.com/gaderjimrs-creator
|
|
155
|
+
|
|
156
|
+
Python Developer | Open Source Enthusiast
|
|
157
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ToolVerse"
|
|
7
|
+
version = "1.2.0"
|
|
8
|
+
description = "A personal Python utility library"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Mohammed Ayaz" }
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
license = { file = "LICENSE" }
|
|
17
|
+
|
|
18
|
+
keywords = [
|
|
19
|
+
"python",
|
|
20
|
+
"utilities",
|
|
21
|
+
"calculator",
|
|
22
|
+
"password-generator",
|
|
23
|
+
"string-tools",
|
|
24
|
+
"file-tools"
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
classifiers = [
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
"License :: OSI Approved :: MIT License",
|
|
30
|
+
"Operating System :: OS Independent"
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
dependencies = [
|
|
34
|
+
"psutil"
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/gaderjimrs-creator/MyPythonLibrary"
|
|
39
|
+
Repository = "https://github.com/gaderjimrs-creator/MyPythonLibrary"
|
|
40
|
+
Issues = "https://github.com/gaderjimrs-creator/MyPythonLibrary/issues"
|
toolverse-1.2.0/setup.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from .calculator import Calculator
|
|
2
|
+
from .conversion_tools import ConversionTools
|
|
3
|
+
from .date_time_tools import DateTimeTools
|
|
4
|
+
from .file_tools import FileTools
|
|
5
|
+
from .number_tools import NumberTools
|
|
6
|
+
from .password_tools import PasswordTools
|
|
7
|
+
from .random_tools import RandomTools
|
|
8
|
+
from .string_tools import StringTools
|
|
9
|
+
from .student_tools import StudentTools
|
|
10
|
+
from .system_tools import SystemTools
|
|
11
|
+
|
|
12
|
+
__version__ = "1.1.0"
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"Calculator",
|
|
16
|
+
"ConversionTools",
|
|
17
|
+
"DateTimeTools",
|
|
18
|
+
"FileTools",
|
|
19
|
+
"NumberTools",
|
|
20
|
+
"PasswordTools",
|
|
21
|
+
"RandomTools",
|
|
22
|
+
"StringTools",
|
|
23
|
+
"StudentTools",
|
|
24
|
+
"SystemTools",
|
|
25
|
+
]
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
class Calculator:
|
|
2
|
+
def __init__(self):
|
|
3
|
+
self.a = 0
|
|
4
|
+
self.b = 0
|
|
5
|
+
|
|
6
|
+
def add(self, a, b):
|
|
7
|
+
self.a = a
|
|
8
|
+
self.b = b
|
|
9
|
+
result = self.a + self.b
|
|
10
|
+
return result
|
|
11
|
+
|
|
12
|
+
def mul(self, a, b):
|
|
13
|
+
self.a = a
|
|
14
|
+
self.b = b
|
|
15
|
+
result = self.a * self.b
|
|
16
|
+
return result
|
|
17
|
+
|
|
18
|
+
def div(self, a, b):
|
|
19
|
+
self.a = a
|
|
20
|
+
self.b = b
|
|
21
|
+
if self.b != 0:
|
|
22
|
+
result = self.a / self.b
|
|
23
|
+
return result
|
|
24
|
+
else:
|
|
25
|
+
return "Division by zero is not allowed"
|
|
26
|
+
|
|
27
|
+
def sub(self, a, b):
|
|
28
|
+
self.a = a
|
|
29
|
+
self.b = b
|
|
30
|
+
result = self.a - self.b
|
|
31
|
+
return result
|
|
32
|
+
|
|
33
|
+
def percentage(self, a, b):
|
|
34
|
+
self.a = a
|
|
35
|
+
self.b = b
|
|
36
|
+
if self.b != 0:
|
|
37
|
+
result = (self.a * self.b) / 100
|
|
38
|
+
return result
|
|
39
|
+
else:
|
|
40
|
+
return "Percentage by zero is not allowed"
|
|
41
|
+
|
|
42
|
+
def sqrt(self, a):
|
|
43
|
+
self.a = a
|
|
44
|
+
if self.a >= 0:
|
|
45
|
+
result = self.a ** 0.5
|
|
46
|
+
return result
|
|
47
|
+
else:
|
|
48
|
+
return "Square root of negative number is not allowed"
|
|
49
|
+
|
|
50
|
+
def square(self, a):
|
|
51
|
+
self.a = a
|
|
52
|
+
result = self.a ** 2
|
|
53
|
+
return result
|
|
54
|
+
|
|
55
|
+
def power(self, a, b):
|
|
56
|
+
self.a = a
|
|
57
|
+
self.b = b
|
|
58
|
+
result = self.a ** self.b
|
|
59
|
+
return result
|
|
60
|
+
|
|
61
|
+
def factorial(self, a):
|
|
62
|
+
self.a = a
|
|
63
|
+
if self.a < 0:
|
|
64
|
+
return "Factorial of negative number is not allowed"
|
|
65
|
+
elif self.a == 0 or self.a == 1:
|
|
66
|
+
return 1
|
|
67
|
+
else:
|
|
68
|
+
result = 1
|
|
69
|
+
for i in range(2, self.a + 1):
|
|
70
|
+
result *= i
|
|
71
|
+
return result
|
|
72
|
+
|
|
73
|
+
def gcd(self, a, b):
|
|
74
|
+
self.a = a
|
|
75
|
+
self.b = b
|
|
76
|
+
while self.b:
|
|
77
|
+
self.a, self.b = self.b, self.a % self.b
|
|
78
|
+
return abs(self.a)
|
|
79
|
+
|
|
80
|
+
def lcm(self, a, b):
|
|
81
|
+
self.a = a
|
|
82
|
+
self.b = b
|
|
83
|
+
if self.a == 0 or self.b == 0:
|
|
84
|
+
return 0
|
|
85
|
+
else:
|
|
86
|
+
return abs(self.a * self.b) // self.gcd(self.a, self.b)
|
|
87
|
+
|
|
88
|
+
def hcf(self, a, b):
|
|
89
|
+
return self.gcd(a, b)
|
|
90
|
+
|
|
91
|
+
def lcm_hcf(self, a, b):
|
|
92
|
+
hcf = self.hcf(a, b)
|
|
93
|
+
lcm = self.lcm(a, b)
|
|
94
|
+
return hcf, lcm
|
|
95
|
+
|
|
96
|
+
def is_prime(self, a):
|
|
97
|
+
self.a = a
|
|
98
|
+
if self.a <= 1:
|
|
99
|
+
return False
|
|
100
|
+
for i in range(2, int(self.a ** 0.5) + 1):
|
|
101
|
+
if self.a % i == 0:
|
|
102
|
+
return False
|
|
103
|
+
return True
|
|
104
|
+
|
|
105
|
+
def prime_factors(self, a):
|
|
106
|
+
self.a = a
|
|
107
|
+
factors = []
|
|
108
|
+
for i in range(2, int(self.a ** 0.5) + 1):
|
|
109
|
+
while self.a % i == 0:
|
|
110
|
+
factors.append(i)
|
|
111
|
+
self.a //= i
|
|
112
|
+
if self.a > 1:
|
|
113
|
+
factors.append(self.a)
|
|
114
|
+
return factors
|
|
115
|
+
|
|
116
|
+
def gst_calculator(self, price, gst_rate):
|
|
117
|
+
self.price = price
|
|
118
|
+
self.gst_rate = gst_rate
|
|
119
|
+
gst_amount = (self.price * self.gst_rate) / 100
|
|
120
|
+
total_price = self.price + gst_amount
|
|
121
|
+
return gst_amount, total_price
|
|
122
|
+
|
|
123
|
+
def discount_calculator(self, price, discount_rate):
|
|
124
|
+
self.price = price
|
|
125
|
+
self.discount_rate = discount_rate
|
|
126
|
+
discount_amount = (self.price * self.discount_rate) / 100
|
|
127
|
+
final_price = self.price - discount_amount
|
|
128
|
+
return discount_amount, final_price
|
|
129
|
+
|
|
130
|
+
def simple_interest(self, principal, rate, time):
|
|
131
|
+
self.principal = principal
|
|
132
|
+
self.rate = rate
|
|
133
|
+
self.time = time
|
|
134
|
+
interest = (self.principal * self.rate * self.time) / 100
|
|
135
|
+
return interest
|
|
136
|
+
|
|
137
|
+
def compound_interest(self, principal, rate, time, n=1):
|
|
138
|
+
self.principal = principal
|
|
139
|
+
self.rate = rate
|
|
140
|
+
self.time = time
|
|
141
|
+
self.n = n
|
|
142
|
+
amount = self.principal * (1 + (self.rate / (100 * self.n))) ** (self.n * self.time)
|
|
143
|
+
return amount - self.principal
|
|
144
|
+
|
|
145
|
+
def percentage_increase(self, original, new):
|
|
146
|
+
self.original = original
|
|
147
|
+
self.new = new
|
|
148
|
+
if self.original != 0:
|
|
149
|
+
increase = self.new - self.original
|
|
150
|
+
percentage_increase = (increase / self.original) * 100
|
|
151
|
+
return percentage_increase
|
|
152
|
+
else:
|
|
153
|
+
return "Original value cannot be zero for percentage increase calculation"
|
|
154
|
+
|
|
155
|
+
def percentage_decrease(self, original, new):
|
|
156
|
+
self.original = original
|
|
157
|
+
self.new = new
|
|
158
|
+
if self.original != 0:
|
|
159
|
+
decrease = self.original - self.new
|
|
160
|
+
percentage_decrease = (decrease / self.original) * 100
|
|
161
|
+
return percentage_decrease
|
|
162
|
+
else:
|
|
163
|
+
return "Original value cannot be zero for percentage decrease calculation"
|
|
164
|
+
|
|
165
|
+
def average(self, numbers):
|
|
166
|
+
self.numbers = numbers
|
|
167
|
+
if len(self.numbers) > 0:
|
|
168
|
+
return sum(self.numbers) / len(self.numbers)
|
|
169
|
+
else:
|
|
170
|
+
return "No numbers provided for average calculation"
|
|
171
|
+
|
|
172
|
+
def median(self, numbers):
|
|
173
|
+
self.numbers = sorted(numbers)
|
|
174
|
+
n = len(self.numbers)
|
|
175
|
+
if n % 2 == 0:
|
|
176
|
+
median = (self.numbers[n // 2 - 1] + self.numbers[n // 2]) / 2
|
|
177
|
+
else:
|
|
178
|
+
median = self.numbers[n // 2]
|
|
179
|
+
return median
|
|
180
|
+
|
|
181
|
+
def mode(self, numbers):
|
|
182
|
+
self.numbers = numbers
|
|
183
|
+
from collections import Counter
|
|
184
|
+
count = Counter(self.numbers)
|
|
185
|
+
mode_data = count.most_common()
|
|
186
|
+
mode = [num for num, freq in mode_data if freq == mode_data[0][1]]
|
|
187
|
+
return mode
|
|
188
|
+
|