Skip to main content

Run the code

Project description

calculatorkzv1

calculatorkzv1 is the package of automated calculator and performing simple arritmetics operations like addition, subtraction, multiplication, division and n-root.

Installation

pip install calculatorkzv1

How to use

Automated calculator

Call automated calculator and package functions:

>>> from calculatorkzv1.calculatorkzv1 import Calculator, 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

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

calculatorkzv1-0.1.0.tar.gz (223.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

calculatorkzv1-0.1.0-py2.py3-none-any.whl (280.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file calculatorkzv1-0.1.0.tar.gz.

File metadata

  • Download URL: calculatorkzv1-0.1.0.tar.gz
  • Upload date:
  • Size: 223.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for calculatorkzv1-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6b76ad3ec390c019921579aa343c7c6bc69cf1c9f426b87ed985b7bd4f5c7690
MD5 ea9b3c486474993085fad8ffd5a2b11d
BLAKE2b-256 0018bd0abddd94603a5150231354d4afe495b0057f81721f241a9d8b0d47a01b

See more details on using hashes here.

File details

Details for the file calculatorkzv1-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for calculatorkzv1-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 85a722fd956aa74a6f22b69a499ce18fcbeec9978a2eb6a2c9d7080ebc48ba34
MD5 cab23d32cf1ca66ec5d50393a6dfb445
BLAKE2b-256 3592fdf6b8fa36716a43f7c7a6c632e5f8c425e550344ad73b7908cb5609f57c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page