$ python
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ python
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ python
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> quit
Use quit() or Ctrl-D (i.e. EOF) to exit
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
$ python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> help
Type help() for interactive help, or help(object) for help about object.
>>> help()
Welcome to Python 3.7's help utility!
If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/3.7/tutorial/.
Enter the name of any module, keyword, or topic to get help on writing
help()
— press Ctrl+Dhelp>
You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)". Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.
>>>
>>> 2*2
4
>>> 2*2
4
>>> 2*4+(3/5)**2
8.36
>>> help(*)
File "
", line 1 help(*)
^
SyntaxError: invalid syntax
help()
expects stringString must be enclosed with quotation marks
'string'
"string"
>>> help('*')
Operator precedence
*******************
The following table summarizes the operator precedence in Python, from
[ skipped ]
:
>>> counter = 42
>>> print("I've already wrote", counter, 'programs')
I've already wrote 42 programs
Now we can execute it
$ python3 program-counter.py
I've already wrote 42 programs
$ python3 program-counter.py
I've already wrote 42 programs
Search for Python interpreter
$ which python3
/usr/bin/python3
Add shebang line as first line of your file
#!/usr/bin/python3
counter = 42
print("I've already wrote", counter, 'programs')
Make your program executable
$ chmod +x program-counter.py
Now you can run it
$ ./program-counter.py
I've already wrote 42 programs
help()