0% found this document useful (0 votes)
27 views58 pages

Lec 01 Introduction To Python-2026

The document provides an introduction to Python, highlighting its features as a high-level, interpreted, object-oriented, and cross-platform programming language. It discusses Python's advantages, including readability, open-source nature, and support for various applications such as data science, machine learning, and web development. Additionally, it covers installation instructions for Python and IDEs, as well as the use of tools like Jupyter Notebook and Google Colab.

Uploaded by

mohamedelmorsi37
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)
27 views58 pages

Lec 01 Introduction To Python-2026

The document provides an introduction to Python, highlighting its features as a high-level, interpreted, object-oriented, and cross-platform programming language. It discusses Python's advantages, including readability, open-source nature, and support for various applications such as data science, machine learning, and web development. Additionally, it covers installation instructions for Python and IDEs, as well as the use of tools like Jupyter Notebook and Google Colab.

Uploaded by

mohamedelmorsi37
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/ 58

INTRODUCTION TO

PYTHON LANGUAGE
LEC-01
Dr. Yasmeen Ali Shalaby
References

• https://www.tutorialsteacher.com/python/
What is Python
• Python is a high-level, interpreted, object-oriented, cross-
platform, and open-sourced programming language.

• An interpreter executes the source code line by line.


• Errors are reported at runtime, which can make
debugging easier.
• Examples of languages that use interpreters include
Python, Ruby, and JavaScript.
Python Advantages
• Python provides enhanced readability. For that purpose,
uniform indents are used to delimit blocks of statements
instead of curly brackets, like in many languages such as C,
C++, and Java.

• Python is free and distributed as open-source software. A large


programming community is actively involved in the
development

• Python supports object-oriented programming (OOP)


principles, allowing developers to create classes and objects.
This helps in organizing code and promoting reusability.
Python Advantages
Python Advantages

• Python is a cross-platform language. It works equally on


different OS platforms like Windows, Linux, Mac OSX, etc.
Hence Python applications can be easily ported across OS
platforms.

• A standard DB-API for database connectivity has been defined


in Python. It can be enabled using any data source (Oracle,
MySQL, SQLite etc.) as a backend to the Python program for
storage, retrieval, and processing of data.
Python Advantages
Python Advantages
Python interacts with several databases, including:

• SQLite: A lightweight, embedded database ideal for small


applications. It comes bundled with Python like sqllite3.
• MySQL: One of the most widely used databases. Libraries like
mysql-connector-python or SQLAlchemy can be used to
connect with MySQL.
• MongoDB: A NoSQL database used for storing unstructured
data for documents like JSON. The pymongo library is
commonly used to communicate with it.
• Oracle: A popular commercial database. You can use the
cx_Oracle library to interact with it.
Where to use Python?
• Data Science
Today Python has become the language of choice for data
scientists.
Python libraries like NumPy, Pandas, and Matplotlib are
extensively used in the process of data analysis, including
the collection, processing and cleaning of data sets,
applying mathematical algorithms, and generating
visualizations for the benefit of users.
Where to use Python?
• Machine Learning
• This is another key application area of Python. Python libraries
such as Scikit-learn, Tensorflow and NLTK are widely used for
the prediction of trends like customer satisfaction, projected
values of stocks, etc.
• Web Development
• This is another application area in which Python is becoming
popular. Web application framework libraries like django,
Pyramid, Flask, etc. for example, uses Django as a backend to
store and synchronize local folders.
• Django: full stack framework, used by major websites like
Instagram, Spotify, and Pinterest. Includes an ORM (Object-
Relational Mapper) integrated DBMS, default SQLite.
Python Syntax
• The print() function in Python displays an output
to a console or to the text stream file. You can
pass any type of data to the print() function to be
displayed on the console.

Python Statements
• Python statement ends with the token NEWLINE
character (carriage return). It means each line in a Python
script is a statement. The following Python script contains
three statements in three separate lines.
• Expressions in parentheses (), square brackets [ ], or
curly braces { } can be spread over multiple lines without
using backslashes.

• Use the semicolon ; to separate multiple statements in a
single line.

Code Comments in Python
Indentation in Python
• Leading space or tab at the beginning of the line is
considered as indentation level of the line, which is used
to determine the group of statements. Statements with the
same level of indentation considered as a group or block
(block of code or block of statement).
• A function contains all the same level indented
statements. The following function contains a block with
two statements.
Indentation Rules
• Use the colon : to start a block and press Enter.
• All the lines in a block must use the same indentation,
either space or a tab.
• Python recommends four spaces as indentation to make
the code more readable. Do not mix space and tab in the
same block.
• A block can have inner blocks with next level indentation.
Python IDEs Integrated Development
Environments
• PyCharm – Cross-platform Python IDE with robust
features
• Visual Studio Code – Lightweight code editor with Python
support
• Spyder – Open-Source Python IDE ideal for data science
• Jupyter Notebook – Browser-based notebook
environment for Python
• Anaconda – IDEs Environments management
Download and Install PyCharm IDE

Step 1) Visit the PyCharm download page

(https://www.jetbrains.com/pycharm/download/) and choose


your platform for Windows, MacOS, and Linux.
Click the “DOWNLOAD” link either the Community Edition (free
forever) or the Professional Edition

Step 2) Once the download is complete, install the PyCharm


software as usual on your computer system. Click “Next” to
start the setup wizard.
• Step 3) Choose the install location (folder) in which you
want to install PyCharm IDE. Setup will install PyCharm
community edition in the below folder.

• To install in a different folder, click Browse and choose


another folder. That is, change the installation path if
required. Click “Next” to continue.
• Step 4) On the next screen, choose 32- or 64-bit launcher
(depending on your operating system). This will create a
desktop shortcut if you want and click on “Next” to
continue.

• Step 5) Choose the start menu folder for PyCharm
shortcuts. Keep selected JetBrains and click on “Install” to
continue the installation process.

Install Python on Windows
• To install Python on a Windows platform, you need to
download the installer. A web-based installer, executable
installer and embeddable zip files are available to install
Python on Windows.
Visit https://www.python.org/downloads/windows and
download the installer based on your local machine's
hardware architecture.
• The web-based installer needs an active internet
connection. So, you can also download the standalone
executable installer.
Visit https://www.python.org/downloads and click on
the Download Python 3.7.0 button as shown below.
(3.7.0 is the latest version as of this writing.)
Python Interpreter: Shell/REPL
• Python is an interpreter language. It means it executes
the code line by line.
• Python provides a Python Shell, which is used to execute
a single Python command and display the result.
• It is also known as REPL (Read, Evaluate, Print, Loop),
where it reads the command, evaluates the command,
prints the result, and loop it back to read the command
again.
Python Editors (Integrated Development
Editors)
• There are many free and commercial IDEs available for Python. Here, we
will learn how to use some open-source editors to execute Python scripts
or statements.

• Jupyter Notebook
• The Jupyter Notebook is a browser-based graphical interface to the
IPython shell. It allows the user to include formatted text, static and
dynamic visualizations, mathematical equations, JavaScript widgets, etc.
along with the Python code. The Jupyter Notebook document can be
exported to PDF, Python script, or HTML.

• By default, the IPython kernel drives the Jupyter Notebook application.


However, it supports other languages like Julia and R. (Jupyter stands for
JUlia, PYThon, and R).

• Jupyter Notebook is a client-server application. The server is deployed


on the localhost's default port 8888 and the client is opened in a browser
window, as shown below:
Installing Python Locally
• Download Anaconda Navigator
• Anaconda Navigator is a user-friendly interface that
handles the installation process for you.
• In order to download Anaconda Navigator go to this link
here: https://www.anaconda.com/
• Next, hover over Products and select Individual Edition,
as seen in the image below.
Using Google Colab

• https://colab.research.google.com/

You might also like