Skip to main content

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

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

calculatorkz-0.1.0.tar.gz (14.6 MB view details)

Uploaded Source

Built Distribution

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

calculatorkz-0.1.0-py2.py3-none-any.whl (4.0 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: calculatorkz-0.1.0.tar.gz
  • Upload date:
  • Size: 14.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.27.1

File hashes

Hashes for calculatorkz-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dd46bf9bfc38eb537e9c3a2fe4ced9d1d0d99bb2b0c2ed2c88a7a6d27d6195bc
MD5 096bd5e61b6e2950723453ee67a433d0
BLAKE2b-256 12a46b14411e901c5ded437acd4e0bc0b2796f692e6aef7e68fa218a7b1e10c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for calculatorkz-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a01b7bddf0186510cb16983ca10aab7192be748d917df1a588d98e946932c992
MD5 5e0b68d4e20d59b31c433de7e7ecd1e0
BLAKE2b-256 4826af0dd2d7ce0a0cb77596d369b1b80f8f17d49707b3dc8133f12e2f669fba

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