0% found this document useful (0 votes)
1 views6 pages

Introduction To Python

The document provides an overview of Python, including its definition, history, features, advantages, and disadvantages. It explains the applications of Python, organizations that use it, and how to work with Python through different execution modes. Additionally, it covers Python's character set, tokens, keywords, identifiers, and variables, along with their rules and usage.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views6 pages

Introduction To Python

The document provides an overview of Python, including its definition, history, features, advantages, and disadvantages. It explains the applications of Python, organizations that use it, and how to work with Python through different execution modes. Additionally, it covers Python's character set, tokens, keywords, identifiers, and variables, along with their rules and usage.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

GETTING STARTED WITH PYTHON

INTRODUCTION
• An ordered set of instructions to be executed by a computer to carry out a specific
task is called a program
• A Programming language is a set of instruction written in specific language (C,
C++, Java, Python)
• A programming language is a computer language that is used to communicate with
computers.
• The program which is translated into machine readable form is known as object code.
• Python uses interpreter to convert its instructions into machine language.
• An interpreter processes the program statements one by one , first translating
and then
• executing.

HISTORY OF PYTHON
• The programming language python was conceived in the late 1980’s by GUIDO
VAN ROSSUM at CENTRAM WISKUNDE AND INFORMATION (CWI) in
Netherlands as a successor to the ABC programming language.
• Python programming implementation was started in December 1989.

WHY IS IT CALLED PYTHON?


• The name python comes from MONTY PYTHON when Guide Van Rossum (Dutch
programmer) was creating python, he was also reading the published scripts from
“Monty Python’s Flying Circus” a BBC comedy series from the 1970’s
• He thought he needed a name that was short, unique and slightly mysterious, so he
decided to call the language PYTHON.

FEATURES OF PYTHON
✓ Python is high-level language. It is free and open source language
✓ It is an interpreted language.
✓ as python programs are executed by an interpreter.
✓ Python programs are easy to understand
as they have clearly defined syntax and simple structure
✓ Python is case-sensitive
for eg: NUM and num are not same in python
✓ Python is portable and platform independent language
means it can run on various operating system and hardware platform
( o/s linux, windows, macos)
✓ Python has a rich library of predefined functions
✓ Python is helpful in web-development. Many web services and applications are built
using python.
✓ Python uses indentation for blocks and nested blocks.

Advantages of Python Programming Language:


1. Easy to Read, Learn and Write
• Python is a high-level programming language that has English-like syntax. This
makes it easier to read and understand the code.
• Python is really easy to pick up and learn, that is why a lot of people recommend
Python to beginners. You need less lines of code to perform the same task as
compared to other major languages like C/C++ and Java.
2. Improved Productivity
• Python is a very productive language. Due to the simplicity of Python, developers
can focus on solving the problem. They don’t need to spend too much time in
understanding the syntax or behaviour of the programming language. You write less
code and get more things done.
3. Interpreted Language
• Python is an interpreted language which means that Python directly executes the
code line by line. In case of any error, it stops further execution and reports back the
error which has occurred.
• Python shows only one error even if the program has multiple errors. This
makes debugging easier.
4. Dynamically Typed
• Python doesn’t know the type of variable until we run the code. It automatically
assigns the data type during execution. The programmer doesn’t need to worry about
declaring variables and their data types.
5. Free and Open-Source
• Python comes under the OSI approved open-source license. This makes
it free to use and distribute. You can download the source code, modify it and even
distribute your version of Python. This is useful for organizations that want to modify
some specific behavior and use their version for development.
6. Vast Libraries Support
• The standard library of Python is huge, you can find almost all the functions needed
for your task. So, you don’t have to depend on external libraries.
• But even if you do, a Python package manager (pip) makes things easier to import
other great packages from the Python package index (PyPi). It consists of over
200,000 packages

Disadvantages of python programming


1.Slow speed
• We discussed above that Python is an interpreted language and dynamically-
typed language. The line by line execution of code often leads to slow execution.
• The dynamic nature of Python is also responsible for the slow speed of Python because
it has to do the extra work while executing code. So, Python is not used for purposes
where speed is an important aspect of the project.
2. Not Memory Efficient
• To provide simplicity to the developer, Python has to do a little tradeoff.
• The Python programming language uses a large amount of memory. This can be a
disadvantage while building applications when we prefer memory optimization.
3. Weak in Mobile Computing
• Python is generally used in server-side programming. We don’t get to see Python on
the client-side or mobile applications because of the following reasons. Python is not
memory efficient and it has slow processing power as compared to other languages.
4.Database Access
• Programming in Python is easy and stress-free. But when we are interacting with the
database, it lacks behind.
• The Python’s database access layer is primitive and underdeveloped in comparison to
the popular technologies like JDBC and ODBC.
• Huge enterprises need smooth interaction of complex legacy data and Python is thus
rarely used in enterprises.
5. Runtime Errors
• As we know Python is a dynamically typed language so the data type of a variable can
change anytime.
• A variable containing integer number may hold a string in the future, which can lead
to Runtime Errors.
• Therefore Python programmers need to perform thorough testing of the applications.

APPLICATIONS

1. GUI-based desktop applications


2. Graphic design, image processing, games, and scientific/computational
applications
3. Web frameworks and applications
4. Enterprise and business applications
5. Operating systems
6. Education
7. Database access
8. Language development
9. Prototyping
10. Data science and machine learning
11. Software development
12. Scripting

Organizations using Python


1. Google (Components of Google spider and Search Engine)
2. Yahoo(Maps)
3. YouTube
4. Mozilla
5. Dropbox
6. Microsoft
7. Cisco
8. Spotify
9. Quora
10. Facebook

WORKING WITH PYTHON


To write and run(execute) a python program we need python interpreter.
The interpreter is also called PYTHON SHELL
EXECUTION MODES
There are two ways to use the python interpreter
a) Interactive mode
b) Script mode
INTERACTIVE MODE
❖ Interactive mode allows execution of individual statement instantly
❖ Interactive mode is useful for testing single line code for instant execution.
❖ We cannot save the statements.
❖ We have to type the statements on the >>>prompt directly, once you press the key,
the statement
gets executed and display the result.

SCRIPT MODE
❖ Script mode allows us to write more than one instruction in a file.
❖ It is called python source code which can be executed
❖ Python programs are saved as files and filename has .py as extension
❖ In script mode after saving the file, we have to click Run->module from the menu.
❖ The output appears on the shell.
❖ Script mode is useful for creating program and then run the programs later
❖ Popular python IDE’s are
❖ Python IDLE, Spyder IDE, Jupyter Notes, Pycharam IDE

PYTHON CHARACTER SET


➢ character set is a set of valid characters that a language can recognize
➢ A character represents any letter, digit or any other symbol.
➢ Python has following character set
I. Alphabets: These include all the small (a-z) and capital (A-Z) alphabets.
II. Digits: It includes all the single digits 0-9.
III. Special Symbols: It includes all the types of special characters," 'l ; : ! ~ @ # $ % ^ `
&*()_+-={}[]\.
IV. White Spaces: White spaces are also a part of the character set. These are tab space,
newline, blank space
and carriage return.
V. Other: Python supports all the types of ASCII and UNICODE characters that
constitute the Python
character set

TOKENS
➢ The smallest individual unit in a program is known as Token or
LEXICAL UNIT.
Eg: Text, individual words and punctuation marks.
Python has following tokens
KEYWORDS
➢ Keywords are RESERVED WORDS
➢ Keywords are the words that has a specific meaning and purposes to the
python interpreter.
➢ Keywords cannot be used as normal identifier names
➢ Python is case-sensitive.
➢ List of all keywords in Python Programming

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

IDENTIFIERS
Identifiers are names used to identify variables, objects, classes , functions, lists,
dictionaries etc.
Rules for writing identifiers
• It can be of any length (it is an long sequence of letters and digits)
• The first character must be letter (either uppercase or lowercase), the
underscore ( _ )
• It cannot start with digit
• It should not be a keyword or reserved word
• Python is case sensitive, it treats uppercase and lowercase differently
• We cannot use special symbols except underscore. (@,!,#.......)
VARIABLES
• Variables are named labels, whose values can be used and processed
during program run.
• Variables refers to an object in python. i.e. an element that is stored in
memory.
• Value of the variable can be string, numeric or any combination of
alphanumeric characters.
Rules
• A variable name must start with a letter or underscore character
• It cannot start with a number
• It can only contain alpha-numeric character and underscore
• They are case-sensitive.
• Cannot use keywords as variables.
Lvalue = Rvalue eg: marks= 20*30+50/10
(object) = (literals and expressions)
Note: variables in python do not have fixed locations. The location changes
every time their values change.
• Variable declaration is implicit, means the variables are declared and
defined automatically when they are assigned a value.
• Assignment statement can be used to create new variable and assign
specific values.
• Variables must always be assigned values before they are used in the
expression, the interpreter replaces it with the value of that particular
variable

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy