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

Chapter 5 Getting Started With Python

Python is a high-level programming language created by Guido Van Rossum in the late 1980s, known for its readability and versatility across various applications such as web development, data science, and artificial intelligence. It offers a large standard library, is free and open-source, but has some drawbacks like slower performance and dynamic typing issues. Python can be used in different environments, including interactive and script modes, and is widely taught due to its beginner-friendly nature.

Uploaded by

Swetha Gundala
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)
1 views21 pages

Chapter 5 Getting Started With Python

Python is a high-level programming language created by Guido Van Rossum in the late 1980s, known for its readability and versatility across various applications such as web development, data science, and artificial intelligence. It offers a large standard library, is free and open-source, but has some drawbacks like slower performance and dynamic typing issues. Python can be used in different environments, including interactive and script modes, and is widely taught due to its beginner-friendly nature.

Uploaded by

Swetha Gundala
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
You are on page 1/ 21

Getting Started

with python
Programming Language

A programming language is a set of


instructions, rules, and syntax used to write
programs that tell a computer what to do
and how to do.
It acts as a communication medium
between the humans and the computer.
Introduction

Python was developed by Guido Van Rossum in late


1980s, and its first official release was in 1991.
He took inspiration from

1. ABC language:
A simple language.
Python borrowed easy to read syntax and simplicity
from ABC.
2. Modula 3:
A language for large, reliable programs.
Python borrowed exception handling and module
system from modula 3.
Introduction
Python is like a blend of many languages.-

1. Easy like ABC.


2. Organized like Module-3
3. Powerful like C.
4. Flexible like Unix Shell.
5. Object oriented like smalltalk.

 It is a very high level programming language.


 Guido Van Rossum named Python after the British comedy
TV show “Monty Python’s Flying Circus”.
 He wanted a name that was short, unique, and slightly
mysterious and playful.

Applications of Python
1. Web Development
 Used to build websites and web applications.
 Frameworks: Django, Flask, FastAPI.
 Example: Instagram and YouTube use Python.

2. Data Science & Data Analysis


 Analyzing data, making graphs, and extracting insights.
 Libraries: Pandas, NumPy, Matplotlib, Seaborn.
 Example: Predicting customer behavior from shopping data.

3. Artificial Intelligence (AI) & Machine Learning (ML)


 Used for training models, image recognition, natural
language processing, etc.
 Libraries: TensorFlow, Keras, Scikit-learn, PyTorch.
 Example: Face recognition in smartphones.
Applications of Python
4. Automation / Scripting
 Automates repetitive tasks (file handling, sending emails,
web scraping).
 Example: Auto-downloading reports from a website every
day.

5. Game Development
 Used to develop simple and complex games.
 Library: Pygame.
 Example: 2D puzzle or arcade games.

6. Desktop Applications
 For making GUI-based applications.
 Libraries: Tkinter, PyQt, Kivy.
 Example: Calculator apps, notepad apps.
Applications of Python
7. Networking Applications
 Writing servers, chat apps, and network automation.
 Libraries: Socket, Twisted, Paramiko.

8. Cybersecurity & Ethical Hacking


 Used in penetration testing, writing security tools.
 Example: Password strength tester, vulnerability
scanners.

9. Scientific & Numeric Computing


 Used in research, simulations, scientific experiments.
 Libraries: SciPy, SymPy.
 Example: Solving complex mathematical equations.
Applications of Python
10. Big Data & Cloud Computing
Handling and analyzing massive datasets.
Used in AWS, Google Cloud, Apache Spark.

11. Embedded Systems & IoT


Python (with MicroPython) is used in small
devices like Raspberry Pi.
Example: Smart home devices, robots.

12. Education
Python is simple and beginner-friendly, so it’s
widely taught in schools and colleges.
Applications of Python
Python - Pluses
 Easy to learn and read.
Example: print (“Hello, Students!”)
 Large standard library

Example: No need to write everything from scratch.


 Cross Platform

Example: works on windows, Mac, Linux etc without changing


the code.
 Free and Open Source
 Expressive Language

Example: short code, readable syntax, powerful built-in functions.

 Interpreted Language: executes line by line.

 Completeness: It has necessary features and tools to build


complete applications.

 Variety of Usage/Applications: develop wide range of


applications
Python - Minuses
1. Not the fast language.
2. Lesser Libraries than C, Java, Perl.
3. Not strong on Type-binding.
Example: you don’t have to declare variables.
The type can change during program
execution. Flexible but, cause errors at run
time.
4. Not easy convertible: coz of dynamic typing (no
fixed types), indentation, special libraries that
may not exist in other languages.
Working in Python
 Default installation from www.python.org called
Cpython installation and comes with Interpreter,
Python IDLE and Pip (package installer).
 Other distributions available: Anaconda Python
distribution that comes preloaded with many
packages and libraries.
 Many popular IDEs are like Spyder IDE, PyCharm IDE
etc.
 Once you have Python installed you can work in Python in
two different ways:
1. Interactive mode (Immediate mode)
2. Script Mode
Interactive Mode (Python
IDLE)
Type one command at a time and python
gives the result.
Script Mode
Interactive mode does not save the
commands entered by you.
Follow these steps:
1. Open Python IDLE
2. File-> New
3. Type the commands
4. File->save (.py extension)
5. Run the script.
Working in Jupyter
Notbook
 Anaconda distribution comes with many preloaded
packages and libraries. You can work with both
interactive and script modes.
 Tools like Jupyter notebook and Spyder are also used
to work in python.
 Jupyter is web based, interactive computing
environment.
 Spyder is used for editing, interactive testing and
debugging feature.
Working with Jupyter
Notebook
 Step 1: launch Anaconda Navigator
 Step 2: click Jupyter notebook in the navigator window.
 Step 3: This will be launched in web browser as it is web based
environment.
 Step 4: On the Notebook, click at down arrow next to New button
and select Python 3 to create a notebook for executing.
 Step5: In a new tab, it will open a new notebook where you can write
and run your code.
 Step 6: To run in interactive mode, type code in code cell and then
click Run.
 Step 7: To run in script mode, write the code in code cell and give a
name when you save it and finally run your script.

 Note: In dashboard you can see your saved files/scripts.


Working with Spyder IDE
 Step 1: launch Anaconda Navigator .
 Step 2: start-> Programs-> Anaconda(folder name)->
Spyder.
 Step 3:
 To run in interactive mode, type the commands in console
window and you can see the output there itself.
 To run in Script mode:
 File->New File..
 File->save as/save
 Save the file with extension as .py
 Step 4: Run the script or use short cut key F5
Writing & Compiling Python program
in Linux
Step 1: Write your program code in a text editor.
Example: nano, vim, emacs, sublime Text etc.
Step 2: Save the program with .py extension.
Step 3: Compile and Run on the Command
prompt by giving appropriate command.
 Open the terminal. Press Ctrl + Alt + T, a
command prompt will appear.
 Go to the folder where you saved the file.
 Type the command: python<filename>.py
 It will compile and Run your program.
Understanding the first
program/script
Interactive mode:
# My first program
Print(“hello world!)

Script mode:
File->new file-> type the program-
> save with .py extension->Run

Note: Use single quotation or double


quotation to enclose the text.

You might also like