0% found this document useful (0 votes)
12 views21 pages

Chapter - 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views21 pages

Chapter - 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Chapter – 1:

Getting Started with Python


By:-
Amit Yerpude
PGT(Computer Science)
Kendriya Vidyalaya, Khagaria
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria

Python Overview

• Python is a general-purpose high-level programming


language. It is an open source language, released under a
GPL-compatible license.
• Python Software Foundation (PSF), a non-profit organization,
holds the copyright of Python.
• Guido Van Rossum conceived Python in the late 1980s.
• It was released in 1991 at Centrum Wiskunde & Informatica
(CWI) in the Netherlands as a successor to the ABC
language. He named this language after a popular comedy
show called 'Monty Python's Flying Circus' (and not after
Python-the snake).
• In the last few years, its popularity has increased immensely.
According to stackoverflow.com's recent survey, Python is in
the top ten Most Popular Technologies in 2018.
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria

• It is also dynamically-typed because it


carries out type-checking at runtime.
• It does so to make sure that the type of
construct matches what we expect it to
be.
• The distinctive feature of Python is that it
is an interpreted language.
• The Python IDLE (Integrated
Development Environment) executes
instructions one line at a time.
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria

Features of Python

• The Python programming language is one


of the richest languages.
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria
i. Easy
Python is very easy to learn and understand, any beginner can understand
the basics of Python.
ii. Interpreted
It is interpreted(executed) line by line. This makes it easy to test and
debug.
iii. Object-Oriented
The Python programming language supports classes and objects.
iv. Free and Open Source
The language and its source code are available to the public for free;
there is no need to buy a costly license.
v. Portable
Since it is open-source, you can run Python on Windows, Mac, Linux or
any other platform. Your programs will work without needing to the
changed for every machine.
vi. GUI Programming
You can use it to develop a GUI (Graphical User Interface). One way to do
this is through Tkinter.
vii. Large Library
Python provides you with a large standard library. You can use it to
implement a variety of functions without needing to reinvent the wheel
every time. Just pick the code you need and continue. This lets you focus
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria

Flavours of Python
i. CPython
This is the most widely accepted implementation of Python. It is written in the
language C, and is an interpreter.
ii. Jython
Jython is a Python implementation written in Java. A Jython program can import any
Java class. It compiles to Java bytecode.
iii. IronPython
IronPython is implemented in C#. It can function as an extensibility layer to
application frameworks written in a .NET language.
iv. Brython
Brython stands for Browser Python. It is an implementation of Python that runs in
the browser.
v. RubyPython
It acts as a bridge between the Python and Ruby interpreters. It marshals data
between Python and Ruby virtual machines.
vi. PyPy
Interesting to know how PyPy is Python implemented in Python. This makes it faster
and easier to experiment with. However, the standard implementation is CPython.
vii. MicroPython
This is an implementation of Python meant to run on a microcontroller. It uses a
MicroPython board that runs MicroPython on bare metal.
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria

Python Applications
Python is easy to pick-up even if you come from a non-programming
background. You can look at the code and tell what’s going on.
Talking of Python applications, some of the cool things that you
can do with Python are –
• Build a website
• Develop a game
• Perform Computer Vision (Facilities like face-detection and color-
detection)
• Implement Machine Learning (Give a computer the ability to learn)
• Enable Robotics
• Perform Web Scraping (Harvest data from websites)
• Perform Data Analysis
• Automate a web browser
• Perform Scripting
• Perform Scientific Computing
• Build Artificial Intelligence
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria

Python Advantages and


Disadvantages
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria

Advantages of Python
1. Extensive Libraries
Python downloads with an extensive library and it contain code for various
purposes like regular expressions, documentation-generation, unit-testing, web
browsers, threading, databases, CGI, email, image manipulation, and more. So,
we don’t have to write the complete code for that manually.
2. Extensible
As we have seen earlier, Python can be extended to other languages. You can
write some of your code in languages like C++ or C. This comes in handy,
especially in projects.
3. Embeddable
Complimentary to extensibility, Python is embeddable as well. You can put your
Python code in your source code of a different language, like C++. This lets us
add scripting capabilities to our code in the other language.
4. Improved Productivity
The language’s simplicity and extensive libraries render programmers more
productive than languages like Java and C++ do. Also, the fact that you need to
write less and get more things done.
5. IOT Opportunities
Since Python forms the basis of new platforms like Raspberry Pi, it finds the
future bright for the Internet Of Things. This is a way to connect the language
with the real world.
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria

Advantages of Python
6. Simple and Easy
When working with Java, you may have to create a class to print ‘Hello World’. But in Python,
just a print statement will do. It is also quite easy to learn, understand, and code. This is why
when people pick up Python, they have a hard time adjusting to other more verbose languages
like Java.
7. Readable
Because it is not such a verbose language, reading Python is much like reading English. This is
the reason why it is so easy to learn, understand, and code. It also does not need curly braces to
define blocks, and indentation is mandatory. This further aids the readability of the code.
8. Object-Oriented
This language supports both the procedural and object-oriented programming paradigms.
While functions help us with code reusability, classes and objects let us model the real world. A
class allows the encapsulation of data and functions into one.
9. Free and Open-Source
Like we said earlier, Python is freely available. But not only can you download Python for free,
but you can also download its source code, make changes to it, and even distribute it. It
downloads with an extensive collection of libraries to help you with your tasks.
10. Portable
When you code your project in a language like C++, you may need to make some changes to it if
you want to run it on another platform. But it isn’t the same with Python. Here, you need to code
only once, and you can run it anywhere. This is called Write Once Run Anywhere (WORA).
However, you need to be careful enough not to include any system-dependent features.
11. Interpreted
Lastly, we will say that it is an interpreted language. Since statements are executed one by one,
debugging is easier than in compiled languages.
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria

Advantages of Python Over Other


Languages
1. Less Coding
Almost all of the tasks done in Python requires less coding when the same task is done
in other languages. Python also has an awesome standard library support, so you don’t
have to search for any third-party libraries to get your job done. This is the reason that
many people suggest learning Python to beginners.

2. Affordable
Python is free therefore individuals, small companies or big organizations can leverage
the free available resources to build applications. Python is popular and widely used so
it gives you better community support.

The 2019 Github annual survey showed us that Python has overtaken Java in
the most popular programming language category.

3. Python is for Everyone


Python code can run on any machine whether it is Linux, Mac or Windows.
Programmers need to learn different languages for different jobs but with Python, you
can professionally build web apps, perform data analysis and machine learning,
automate things, do web scraping and also build games and powerful visualizations. It
is an all-rounder programming language.
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria

Disadvantages of Python
1. Speed Limitations
We have seen that Python code is executed line by line. But since Python is interpreted, it
often results in slow execution. This, however, isn’t a problem unless speed is a focal
point for the project. In other words, unless high speed is a requirement, the benefits
offered by Python are enough to distract us from its speed limitations.

2. Weak in Mobile Computing and Browsers


While it serves as an excellent server-side language, Python is much rarely seen on the
client-side. Besides that, it is rarely ever used to implement smartphone-based
applications. One such application is called Carbonnelle.
The reason it is not so famous despite the existence of Brython is that it isn’t that secure.

3. Design Restrictions
As you know, Python is dynamically-typed. This means that you don’t need to declare the
type of variable while writing the code. It uses duck-typing. But wait, what’s that? Well,
it just means that if it looks like a duck, it must be a duck. While this is easy on the
programmers during coding, it can raise run-time errors.

4. Underdeveloped Database Access Layers


Compared to more widely used technologies like JDBC (Java DataBase Connectivity)
and ODBC (Open DataBase Connectivity), Python’s database access layers are a bit
underdeveloped. Consequently, it is less often applied in huge enterprises.
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria

How to download and installPython?


• Python can be downloaded from
www.python.org.
• It is available in two versions-
 Python 2.x
 Python 3.x
• We will download 3.8 here.
• Open www.python.org on any browser.
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria

Working in Python
• Python support two types of mode

1. Interactive mode
Write in Python Shell, Line-by-line
Programming

2. Script mode
Write in Script file, Block Programming
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria

Interactive Mode
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria

Script Mode
By:- Amit Yerpude, P 12/07/2024
GT CS, KV Khagaria

Thank You!!!

You might also like