Python is an interpreted language. We can either
collect sequences of commands into text files and save this to a file as a Python
program. It is convention that these files have the file extension “.py",for
example
test.py.
We can also enter individual commands at the Python
prompt which are immediately evaluated and carried out by the Python
interpreter. This is very useful to understand how to use certain commands
(often before one puts these commands together in a longer Python program )
To start the interpreter we can either
On windows/Linux : start IDLE
OR
On windows: Find the MS-DOS prompt, and type python followed
by the return key.
On Linux/Unix/Mac OSX: Go to the terminal type python followed
by the return key.
The python prompt (the chevron >>>) signals
that Python is waiting for input from us:
>>>
We can now enter commands, for example 4+5, followed by
the RETURN key.
>>> 4+5
9
>>>
Once we press the return key, Python will evaluate the
expression (4+5) and display the computed value (9) in the next line. It then
displays the python prompt (>>>) in the next line to indicate that it
is ready for the next input.
This interactive programming environment is sometimes
referred to as the read-eval-print loop (REPL), because the expression is read,
evaluated, the result is printed, and then the loop starts again.
Now you can try the other arithmetic operations
+(add) -(sub) *(mul)
/(div) %(mod) **(exp)
Examples:
>>>4+3
7
>>>4-3
1
>>>4*3
12
>>>4/3
1
>>>4%3
1
>>>4**3
64
>>>4+3
7
>>>4-3
1
>>>4*3
12
>>>4/3
1
>>>4%3
1
>>>4**3
64
I just found this blog and have high hopes for it to continue. I have added to my favorites. python course
ReplyDeletePretty Post! Thank you so much for sharing this good content, it was so nice to read and useful to improve my knowledge as an updated one, keep blogging.
ReplyDeletePython Certification Training in Electronic City