Introduction to Python

Python was created in 1989 by Guido van Rossum in the Netherlands as a scripting language for administrative tasks. It was released publicly in 1991 and has no growing community of Python developers. Python is open-source, scalable, object-oriented, and functional from the beginning. Let us start with the introduction to Python.

Features of Python

  • Python is a general-purpose computer programming language with a certain syntax and semantics like human languages. It follows certain rules (grammar).
  • It is a high-level language
  • It is an interpreter (executes command by command)
  • It is freely available
  • Used by NASA, IBM, Netflix, Facebook, Spotify, and many others.
  • YouTube, Reddit, Pinterest, and Instagram Code is written in Python
Features of Python

Installation of Python and Anaconda Distribution

Download the Python Language (Download the Version according to your requirement and operating system).

One can either (i) install the standard option or customize the installation.

Python Installation

It is better to opt for the Install Now option and do not forget to tick the options “Use admin privileges when installing py.exe” and “Add python.exe to PATH“.

Python Customize Installation

For customized installation opt for all the options and finally click the install button, to proceed with the installation of the Python.

Anaconda distribution is free to install and contains libraries for Data Science, Machine Learning, and Artificial Intelligence. It also contains modules required for data analysis. However, Anaconda is not compulsory for Python Programming. Installing Anaconda includes both the core Python interpreter and standard libraries.

The download link for Anaconda is https://www.anaconda.com/download.

Note that you do not need to install Python separately when using Anaconda, as Anaconda comes with its version of Python.

It is better to verify the Python installation.

python --version
pip -V

pip is a Python package management system for installing Python libraries, therefore pip must be installed on your computer system.

Python Editors for Programming

To write Python scripts or codes one needs to use text-editing software.

  • IDLE (Integrated Development and Learning Environment) Python
  • IPython (Interactive Python)
  • Thonny IDE
  • Jupyter Notebook
  • Spider

Important Parts to Write Computer Programs

The important parts of a computer program are:

  • Input (from mouse, keyboard, or a file)
  • Computation (Statistical and Mathematical)
  • Conditional execution
  • Repetition (doing things again and again)
  • Output

Also, remember that the computer only does what you tell it to do. If something is wrong it’s your mistake.

  • Your program/ code may get wrong:
  • Incorrect syntax,
  • Choosing the wrong function and argument,
  • Something missed in typing,
  • Logical mistakes
  • Incorrect selection of software
  • Whenever something gets wrong, You need to debug (going back and fixing the errors)
  • Whenever something gets wrong Your program could run forever
  • you may get the wrong (unexpected) output)

Python Objects

Everything in Python is an object, which means every entity:

  • has some metadata called “attributes” and
  • associated functionality called “methods”

Objects come in different types:

  • int: integers
  • float: real numbers
  • bool: True/ False
  • str: Strings
  • None: Null

These are all basic data types in Python.

Python Keywords

The following is the list of keywords in Python. Keywords in Python are reserved words that can not be used as a variable name, function name, or any other identifier.

help("keywords")

# output
Here is a list of the Python keywords.  Enter any keyword to get more help.

False               class               from                or
None                continue            global              pass
True                def                 if                  raise
and                 del                 import              return
as                  elif                in                  try
assert              else                is                  while
async               except              lambda              with
await               finally             nonlocal            yield
break               for                 not                 

Python File Extension

Python script files have extensions of *.py. The Notebook file extension is *.ipynb.

Introduction to Python Programming live demonstration.

https://itfeature.com