0% found this document useful (0 votes)
5 views1 page

Python 01: Basic Arithmetic Operations

The document describes the functionality of an interpreter that acts as a simple calculator, allowing users to input arithmetic expressions. It supports basic operators such as addition, subtraction, multiplication, and division, along with the use of parentheses for grouping. Examples demonstrate how to use the interpreter to evaluate expressions and the behavior of division returning floating-point numbers.

Uploaded by

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

Python 01: Basic Arithmetic Operations

The document describes the functionality of an interpreter that acts as a simple calculator, allowing users to input arithmetic expressions. It supports basic operators such as addition, subtraction, multiplication, and division, along with the use of parentheses for grouping. Examples demonstrate how to use the interpreter to evaluate expressions and the behavior of division returning floating-point numbers.

Uploaded by

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

3.1.1.

Numbers
The interpreter acts as a simple calculator: you can type an expression at it and
it will write the value. Expression syntax is straightforward: the operators +, -,
* and / can be used to perform arithmetic; parentheses (()) can be used for
grouping. For example:

>>>
2 + 2
4
50 - 5*6
20
(50 - 5*6) / 4
5.0
8 / 5 # division always returns a floating-point number
1.6

You might also like