0% found this document useful (0 votes)
7 views2 pages

Python Calculator: Quick Start Guide

The document provides a guide on using the Python interpreter as a calculator, detailing how to start the interpreter and perform basic arithmetic operations. It also explains how to use the math module for advanced functions and how to store results in variables. Finally, it describes how to exit the interpreter properly.

Uploaded by

rajkiranjntuhcem
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Python Calculator: Quick Start Guide

The document provides a guide on using the Python interpreter as a calculator, detailing how to start the interpreter and perform basic arithmetic operations. It also explains how to use the math module for advanced functions and how to store results in variables. Finally, it describes how to exit the interpreter properly.

Uploaded by

rajkiranjntuhcem
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1. Start a Python interpreter and use it as a Calculator.

1. Starting the Python Interpreter


You can start Python in interactive mode (REPL) by typing one of the following in your
terminal:

python

or

python3

You should see something like:

Python 3.x.x (default, …)


>>>

The >>> prompt means Python is ready for commands.

2. Basic Arithmetic
Python supports normal math operations:

Operation Example Result


Addition >>> 2 + 3 5
Subtraction >>> 10 - 4 6
Multiplication >>> 7 * 8 56
Division >>> 10 / 4 2.5
Integer division >>> 10 // 4 2
Remainder >>> 10 % 4 2
Power >>> 2 ** 5 32

3. Using Math Functions


Import the math module:

>>> import math

Examples:

>>> [Link](2)
1.4142135623730951

>>> [Link](1)
0.8414709848078965

>>> [Link]
3.141592653589793

4. Using Variables
You can store results:

>>> x = 10
>>> y = 3
>>> x * y
30

5. Exiting the Interpreter


You can leave Python by typing:

>>> exit()

or pressing:

CTRL + D (Linux/Mac)
CTRL + Z then Enter (Windows)

You might also like