WHAT IS PYTHON

PYTHON

Python: It is a general-purpose, dynamic, high-level, and interpreted programming language.

  • It supports the Object-Oriented Programming (OOP) approach to develop applications.
  • It is simple and easy to learn and provides many high-level data structures.
  • It is easy to learn yet powerful and versatile, which makes it attractive for application development.
  • It supports multiple programming paradigms, including object-oriented, imperative, functional, and procedural programming styles.
  • It makes development and debugging fast because there is no compilation step, and the edit-test-debug cycle is quick.
  • It is dynamic in nature because memory allocation is handled automatically. We do not need to declare data types explicitly when creating variables.

FEATURES OF PYTHON

  • Python supports object-oriented and procedural programming approaches and provides dynamic memory allocation.
  • It is easy to learn compared to other programming languages. Its syntax is simple and similar to the English language. There is no need to use semicolons or curly brackets, as indentation defines code blocks.
  • It is an expressive language, meaning Python can perform complex tasks using fewer lines of code.
  • It is an interpreted language, meaning Python programs are executed line by line, making debugging easier.
  • It is a cross-platform language, meaning it runs on different platforms such as:
    • Windows
    • Linux
    • UNIX
    • Macintosh
  • It is a free and open-source language, available at www.python.org. It has a large global community developing new modules and libraries.
  • It supports Object-Oriented Programming concepts such as:
    • Inheritance
    • Polymorphism
    • Encapsulation
  • It provides a wide range of libraries for different fields such as:
    • Machine Learning (TensorFlow, Pandas, NumPy, Keras, PyTorch)
    • Web Development (Django, Flask, Pyramid)
  • It supports GUI (Graphical User Interface) development using libraries such as:
    • PyQt5
    • Tkinter
    • Kivy
  • Python allows integration with other programming languages.
  • Python automatically allocates memory when a value is assigned to a variable at runtime.

USES OF PYTHON

Python is widely used in:

  • Web development
  • GUI desktop application development
  • Console-based applications
  • Scientific and numerical computing
  • Business applications
  • Audio and video-based applications
  • 3D CAD applications
  • Enterprise applications

HISTORY OF PYTHON

  • Python was developed in the late 1980s.
  • The implementation of Python started in December 1989 by Guido van Rossum at CWI (Centrum Wiskunde & Informatica) in the Netherlands.
  • In February 1991, Guido van Rossum released Python version 0.9.0.
  • In 1994, Python 1.0 was released with features like:
    • lambda
    • map
    • filter
    • reduce
  • Python 2.0 introduced:
    • List comprehensions
    • Garbage collection
  • On December 3, 2008, Python 3.0 (Py3K) was released to correct fundamental design issues.
  • The ABC programming language is considered the predecessor of Python.
  • Programming languages that influenced Python include:
    • ABC
    • Modula-3

VARIABLES

Variable: A variable is a name used to refer to a memory location.

  • A variable is also known as an identifier and is used to store values.
  • In Python, we do not need to specify the variable type because Python automatically determines it.
  • Variable names can contain letters and digits but must begin with:
    • A letter
    • Or an underscore (_)
  • Python is a case-sensitive language, meaning:
    • SUM and sum are different variables.

IDENTIFIER NAMING RULES

An identifier is a name used to identify programming elements such as variables, functions, or classes.

Rules for naming identifiers:

  • The first character must be:
    • A letter
    • Or an underscore (_)
  • Other characters may include:
    • Lowercase letters (a–z)
    • Uppercase letters (A–Z)
    • Digits (0–9)
    • Underscore (_)
  • Identifier names must not contain:
    • Spaces
    • Special characters (!, @, #, %, ^, &, *)
  • Identifier names must not match Python keywords.
  • Identifier names are case-sensitive.
    Example: Vikas and VIKAS are different.

Examples

Valid identifiers:

  • a123
  • _n
  • n_9

Invalid identifiers:

  • 1a
  • n%4
  • n 9

DATA TYPE

Data type: It represents the type of value stored in a variable.

  • It defines what kind of value can be stored.
  • Python provides the type() function to check the data type of a variable.
  • In Python, there is no need to declare data types before assigning values.

Example:

a = 10
b = "Hi vmsm"
c = 10.5

print(type(a))
print(type(b))
print(type(c))

This example shows that Python automatically determines the data type.

TYPES OF DATA IN PYTHON

Python provides the following data types:

  1. Number (Integer, Float, Complex)
  2. Dictionary
  3. Boolean
  4. Set
  5. Sequence Type
    • String
    • List
    • Tuple

NUMBER DATA TYPE

The Number data type stores numeric values.

Types of numbers include:

  • Integer
  • Float
  • Complex number

Integer

  • Integer stores whole numbers (positive or negative).
  • Python does not limit the length of integer values.

Example:

a = 10
b = -25
c = 100000

Comments

Popular posts from this blog

FLOW CHART

HTML

BASIC CONCEPT OF C++