=>> This is 2.2 section of Python tutorial, and i am going to tell u about Python as a calculator. yes,we can use Python shell or any Python IDE as a calculator.
Link of previous linked tutorial
-> 2.1 : https://dev.to/mohit355/python-basics-3cjd
-> 1.2 : https://dev.to/mohit355/download-and-install-python-3-x-1boo
=>> Python is perfectly suited to do basic calculations.
**Along with addition, subtraction, multiplication and division, there is also support for more advanced operations such as:
- (+) : Addition
- (-) : Subtraction
- (*) : Multiplication
- (/) : Float division ,return decimal value as output
- (//) : Integer division ,return integer value as output
- (%) : Modulo ,it will gives reminder
- (**) : Exponent In above figure some addational operations shown but don't worry these are function which is predefined in Python that will be discussed later in this series.
#Ans- .This is because we need not to code many number of line to sum two number or divide or multiply.
we can directly print it using print function. (print function is already discuss in previous post).
- I want to add three number 2,3 and 4. so we directly use print(2+3+4) and its output is 9 as shown below.
let's perform following operations : 2+3-4/2
we can simply done this by print(2+3-4/2) and its output is shown below.
Its print 3.0 because here we use float division and it always return a decimal value
=>> So we can do any type of mathematical calculation using simply print function.
=> If you have any problem let me know that in comment box.