Run the code
Project description
calculatorkz
calculatorkz
is the package of automated calculator and performing simple arritmetics operations like addition, subtraction, multiplication, division and n-root.
Installation
pip install calculatorkz
How to use
Automated calculator
Call automated calculator and package functions:
>>> from calculatorkz import Calculator
>>> calculator()
Select operation:
0. Exit
1. Add
2. Subtract
3. Multiply
4. Divide
5. Take (n) root
6. Reset calculator
Enter choice (0/1/2/3/4/5/6):
After imported package function calculator()
initiates automated calculator, which asks you select one of the action/operation you would like to be performed. Thus, enter the choise - integer number from 0 to 6. Then you will be asked to enter the number you want operation would be applied to.
Automated calculator has memory, which at the begining starts from 0. But after the operation and number entering it accumulates,
e.g. 0 + 2 = 2, 2*3 = 6, 6/2=3
, etc.
The memory can be reseted after selection of 6.
To keep the calculation further enter yes
, to end calculation answer no
. Exit calculation can be by entering 0 on the choise selections step.
For examples:
>>> calculator()
Select operation:
0. Exit
1. Add
2. Subtract
3. Multiply
4. Divide
5. Take (n) root
6. Reset calculator
Enter choice (0/1/2/3/4/5/6): 1
Enter your number: 2
Result: 0.0 + 2.0 = 2.0
Let's do next calculation? (yes/no): yes
Enter choice (0/1/2/3/4/5/6): 3
Enter your number: 3
Result: 2.0 * 3.0 = 6.0
Let's do next calculation? (yes/no): yes
Enter choice (0/1/2/3/4/5/6): 2
Enter your number: 4
Result: 6.0 - 4.0 = 2.0
Let's do next calculation? (yes/no): yes
Enter choice (0/1/2/3/4/5/6): 6
Reset to: 0
Let's do next calculation? (yes/no): yes
Enter choice (0/1/2/3/4/5/6): 5
Enter your number: 9
Result: 0.0 ^(1/9.0) = 0.0
Let's do next calculation? (yes/no): yes
Enter choice (0/1/2/3/4/5/6): 1
Enter your number: 9
Result: 0.0 + 9.0 = 9.0
Let's do next calculation? (yes/no): yes
Enter choice (0/1/2/3/4/5/6): 5
Enter your number: 2
Result: 9.0 ^(1/2.0) = 3.0
Let's do next calculation? (yes/no): yes
Enter choice (0/1/2/3/4/5/6): 4
Enter your number: 2
Result: 3.0 / 2.0 = 1.5
Let's do next calculation? (yes/no): no
Final result = 1.5
Calculator class methods
In this package you can allso use class methods, e.g.
- Create the object of two values:
>>> x1 = 2
>>> x2 = 3
>>> obj = Calculator(x1,x2)
>>> obj
<calculatorkz.Calculator object at 0x101b6dde0>
- Add them:
>>> obj.add()
5
- Substract two values:
>>> obj.subtract()
-1
- Multiply two values:
>>> obj.multiply()
6
- Divide them:
>>> obj.divide()
0.6666666666666666
- Take x2 root from x1:
>>> obj.n_root()
1.2599210498948732
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for calculatorkz-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a01b7bddf0186510cb16983ca10aab7192be748d917df1a588d98e946932c992 |
|
MD5 | 5e0b68d4e20d59b31c433de7e7ecd1e0 |
|
BLAKE2b-256 | 4826af0dd2d7ce0a0cb77596d369b1b80f8f17d49707b3dc8133f12e2f669fba |