0% found this document useful (0 votes)
18 views4 pages

Introduction to Python Programming

Python is an object-oriented, high-level programming language created by Guido Van Rossum in 1991, influenced by the ABC language and named after Monty Python's Flying Circus. It features easy coding, open-source availability, GUI support, portability, dynamic typing, and a large standard library, making it suitable for web development, data analysis, game development, and desktop applications. Python identifiers must follow specific naming rules, and the language includes reserved keywords, variables for memory storage, various data types, operators, and input/output functions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views4 pages

Introduction to Python Programming

Python is an object-oriented, high-level programming language created by Guido Van Rossum in 1991, influenced by the ABC language and named after Monty Python's Flying Circus. It features easy coding, open-source availability, GUI support, portability, dynamic typing, and a large standard library, making it suitable for web development, data analysis, game development, and desktop applications. Python identifiers must follow specific naming rules, and the language includes reserved keywords, variables for memory storage, various data types, operators, and input/output functions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

UNIT-I

What is Python?
Python is an object-oriented, high level language, interpreted, dynamic and multipurpose programming language.

HISTORY:

 Python was first introduced by Guido Van Rossum in 1991 at the National Research Institute for Mathematics and
Computer Science, Netherlands.
 Though the language was introduced in 1991, the development began in the 1980s. Previously van Rossum worked on
the ABC language at Centrum Wiskunde & Informatica (CWI) in the Netherlands.
 The ABC language was capable of exception handling and interfacing with the Amoeba operating system. Inspired by
the language, Van Rossum first tried out making his own version of it.
 Python is influenced by programming languages like: ABC language, Modula-3, Python is used for software
development at companies and organizations such as Google, Yahoo, CERN, Industrial Light and Magic, and NASA.
 Inspired by Monty Python’s Flying Circus, a BBC comedy series, he named it Python.

FEATURES OF PYTHON:

There are a lot of features provided by python programming language as follows


1. Easy to Code: Python is a very developer-friendly language which means that anyone and everyone can learn to code it. As
compared to other object-oriented programming languages like Java, C, C++, and C#, Python is one of the easiest to learn.
2. Open Source and Free: Python is an open-source programming language which means that anyone can create and contribute
to its development.
3. Support for GUI: GUI or Graphical User Interface is one of the key aspects of any programming language because it has the
ability to add flair to code and make the results more visual
4. Object-Oriented Approach: One of the key aspects of Python is its object-oriented approach. This basically means that
Python recognizes the concept of class and object encapsulation thus allowing programs to be efficient in the long run.
5. Highly Portable: Suppose you are running Python on Windows and you need to shift the same to either a Mac or a Linux
system, then you can easily achieve the same in Python without having to worry about changing the code. .
6. Highly Dynamic : Python is one of the most dynamic languages available in the industry today. What this basically means is
that the type of a variable is decided at the run time and not in advance
7. Large Standard Library: Out of the box, Python comes inbuilt with a large number of libraries that can be imported at any
instance and be used in a specific program.

THRUST AREAS OF PYTHON:

The major thrust areas of Python are:


[Link] development – Web framework like Django and Flask are based on Python. They help you write server side code which
helps you manage database, write backend programming logic, mapping urls etc.
2. Data Analysis – Data analysis and data visualisation in form of charts can also be developed using Python.
3. Game development – You can develop games using Python.
4. Desktop applications – You can develop desktop application in Python using library like TKinter or QT

IDENTIFIERS:

Identifiers in Python are names given to various entities such as variables, functions, classes, and modules.

Rules for Naming Identifiers


1. Identifiers must start with a letter or an underscore (_), not a digit.
2. Identifiers can include letters (A-Z, a-z), digits (0-9), and underscores (_).
3. Identifiers should not contain special characters like !, @, #, $, etc.
4. Identifiers should not contain white or blank spaces.
5. An identifier name in Python is case-sensitive i.e, sum and Sum are two different identifier.
6. An identifier name should not be a keyword
KEYWORDS:

Keywords are the reserved words in Python. We cannot use a keyword as a variable name, function name or any other identifier
False await else import pass

None break except in raise

True class finally is return

and continue for lambda try

as def from nonlocal while

assert del global not with

async elif if or yield

VARIABLES:

Python variables are the reserved memory locations used to store values with in a Python Program. This means that when you
create a variable you reserve some space in the memory. Based on the data type of a variable, memory space is allocated to it.
Therefore, by assigning different data types to Python variables, you can store integers, decimals or characters in these variables.

Example:

name = "Alice" # string

age = 25 # integer

height = 5.7 # float

is_student = True # boolean

DATATYPES

Data types specify the type of data that can be stored inside a [Link] are classified into different types. They are

Data Types Classes Description

Numeric int, float, complex holds numeric values

Sequence list, tuple, string holds collection of data items

Dictionary dict holds data in key-value pair form

Boolean bool holds either True or False

Set set hold collection of unique items


OPERATORS:

Operators are special symbols that perform operations on variables and values

Reading Input, Print Output:

In python input() is used to read the input from the keyboard dynamically. By default, the value of the input function will be
stored as a string

Syntax: Variable name =input(‘prompt’)

An output function is used to show messages, results, or values on the screen.

In Python, we use the print() function to display output.

Example: name = input("Enter your name: ")

print("Hello,", name)

Output:

Enter your name: ram

Hello, ram

Type Conversions:

The process of converting the value of one data type to another data type is called type conversion. Python has two types of type
conversion.

Implicit Type Conversion: Python automatically converts one data type to another data type. This process doesn't need any user
involvement.

Example

x = 10
y = 3.5
result = x + y
print(result)
print(type(result)) # <class 'float'>

Note: Python automatically converts int to float.


Explicit Type Conversion: Users convert the data type of an object to required data type. We use the predefined functions like
int(), float(), str(), etc to perform explicit type conversion This type of conversion is also called typecasting because the user
changes the data type of the objects.

Example:

s = "123"

num = int(s)
print(num + 10) # 133

You might also like