DEV Community

Veera Ganapathi
Veera Ganapathi

Posted on

Python Programming

What is Python?

Python is a popular, high-level computer programming language known for its clear syntax, readability, and general-purpose versatility.

Key Features:

  • Simple syntax: Uses clean, English-like words instead of complex symbols or curly brackets.
  • Interpreted: Code runs line by line, which makes finding errors fast and easy.
  • Dynamic typing: You do not need to declare variable types ahead of time.
  • Free and open-source: Available to download and use on all major operating systems.
print("Hello, World!")

Output:
Hello, World!
Enter fullscreen mode Exit fullscreen mode

  • print() is a built-in Python function that instructs the computer to display text on the screen.
  • "Hello, World!" is a string enclosed within quotes (either single ' or double ").
  • Python uses indentation (spaces or tabs) to define code blocks instead of braces {} in C, C++ and Java .

What is Python 2?

  • Python 2.0 was introduced to the tech world in the year 2000.
  • Created by the BeOpen Python Labs team, the purpose of the introduction of Python 2 was to make programming simple and easy to learn for the common masses.
  • Python 2 was successful in implementing the technical details of the Python Enhancement Proposal (PEP).
  • However, after the introduction of Python 3, Python 2 could not find a lot of its usage in the tech world and the year 2020 marked the end of Python 2’s legacy with Python 2.7 being its latest version.

Given below is a timeline of the release of the various versions of the Python 2.X series:

  • Python 2.0 – October 16, 2000
  • Python 2.1 – April 17, 2001
  • Python 2.2 – December 21, 2001
  • Python 2.3 – July 29, 2003
  • Python 2.4 – November 30, 2004
  • Python 2.5 – September 19, 2006
  • Python 2.6 – October 1, 2008
  • Python 2.7-July 3, 2010

Difference Between Python 2 and 3:

Python Indentation:

  • Indentation refers to the spaces at the beginning of a code line.
  • Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important.
  • Python uses indentation to indicate a block of code.
if 5 > 2:
  print("Five is greater than two!")

Output:
Five is greater than two!
Enter fullscreen mode Exit fullscreen mode
if 5 > 2:
print("Five is greater than two!")

Output:
SyntaxError: expected an indented block after 'if' statement on line 1
Enter fullscreen mode Exit fullscreen mode

Top comments (0)