DEV Community

Vinay Keshava
Vinay Keshava

Posted on

Python Day-1

1.Python Interpreter

Python Interpreter
Python can launched by typing python3 in the prompt of you linux terminal .

' >>> ' this is python prompt,waiting for the input.
Python interpreter can be used as a calculator,simple arithematic calculations can be using the operators +,-,*,/,(()) .

Variables can also be used in the python interpreter and values are assigned to it.
In the example shown width and height are variables and values are assigned to it , their value is calculated and stored in 'area', later using the print() function the value of area is printed.

Python interpreter Calculator Examples

Python supports integer, floating, decimal, fraction and also python has builtin functions for complex number it used 'j' to indicate the imaginary part 3+5j

Complex Numbers in python interpreter

-> To open a file in interpreter mode
python3 -i filename.py

2.Strings
-> Single Quotes: Identifier representation.
-> Double Quotes: String representation.
-> Triple Quotes: Multiline Texts
The below table represents how python uses indices

+---+---+---+---+---+---+
| P | y | t | h | o | n |
+---+---+---+---+---+---+
0 1 2 3 4 5 6

-6 -5 -4 -3 -2 -1
Python Strings

Top comments (0)