Python - Interactive Console

Getting started with Python Interactive Console, a simple way to learn how to code in Python.

Python Interactive Console - PowerShell usage.
Python Interactive Console - PowerShell usage 

Python is a popular language that we can use to code many types of projects: web apps, games, OS system programming, or even data analytics and machine learning. Once Python is properly installed and accessible in the terminal windows, we can start writing code using the Python Interactive Console.

$ python --version
Python 3.8.4       <--- The output
Python - Check Version

In case the above command returns an error, probably Python is not installed or not present in the execution PATH of your operating system.  

Python - Launch the console
$ python
Python 3.8.4 [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Python - Console Output
Working into the Python Console
$ python
>>>       
>>> my_name = 'Bill'    # define a variable
>>> my_name             # uses the variable 
'Bill'
>>>
>>> 1 + 2               # return the addition of two numbers 
3 
Python Console - Define Variables
Python Console - Use Modules

Before using any module, we need to install it first via PIP, the official package manager for Python.

$ pip install webbrowser
PIP install webbrowser

The above command will install webbrowser module, a popular web browser controller.

$ python                                  # start the Python Console
>>> 
>>> import webbrowser                     # import the module
>>> webbrowser.open('https://appseed.us') # open a web page
True
Python - Import a module
Python Console - Exit

Once all our work is done we can exit from the Python console using the command quit()

$ python        # start the console
>>> 
>>> 1 + 1       # coding stuff     
2 
>>>
>>> quit()      # exit from the console     
Python - Exit from the Console

Thanks for reading! For more resources, feel free to access: