0% found this document useful (0 votes)
24 views17 pages

Python Basics for Machine Learning

The document provides an overview of Python as a high-level programming language, emphasizing its open-source nature and versatility for various applications, particularly in machine learning. It introduces Anaconda as a popular distribution for data science and discusses key concepts such as variable definitions, conditional structures, loops, functions, and the use of packages in Python. Additionally, it covers native data types including strings, arrays, and dictionaries.

Uploaded by

Salma
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)
24 views17 pages

Python Basics for Machine Learning

The document provides an overview of Python as a high-level programming language, emphasizing its open-source nature and versatility for various applications, particularly in machine learning. It introduces Anaconda as a popular distribution for data science and discusses key concepts such as variable definitions, conditional structures, loops, functions, and the use of packages in Python. Additionally, it covers native data types including strings, arrays, and dictionaries.

Uploaded by

Salma
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

Python for ML

EMI| Semestre 1 | Pr Mohamed RHAZZAF

04/10/2025 Mohamed RHAZZAF 1


Definition

Python is high level script programming language


•Open source
•Multi-paradigm
•Multi-usage
•Portable
•Object oriented

04/10/2025 Mohamed RHAZZAF 2


Anaconda

• Anaconda is a popular open-source distribution of the Python and R programming languages for data
science, machine learning, and scientific computing.
• It includes a comprehensive collection of pre-installed packages and libraries that are commonly
used in these fields

04/10/2025 Mohamed RHAZZAF 3


Jupyter notebook

04/10/2025 Mohamed RHAZZAF 4


Jupyter notebook

04/10/2025 Mohamed RHAZZAF 5


Jupyter notebook

04/10/2025 Mohamed RHAZZAF 6


Variables

• Python don’t use typing for variables


– There is no predefined type for variables ( not like C, C++, or java)
– You can change the type inside a program
• Name of variables:
– Starting with letter or ‘_’
– You can use digits but not in the start
– You cannot use /*-+# and so on
– You cannot use special words (if , else, while,..) as name for variables
• Example:
– mon_age=6
– heur=None
– mon_nom=‘Mohamed’
– is_here= True
– _tmp=3

04/10/2025 Mohamed RHAZZAF 7


Conditional structures

04/10/2025 Mohamed RHAZZAF 8


Conditional structures

Symbol Meaning
< Inferior
> Superior
<= Inferior or equal
>= Superior or equal
== / != Equal / different

Keywords for combination of conditions:


• and
• or
• not

04/10/2025 Mohamed RHAZZAF 9


Loops in python

04/10/2025 Mohamed RHAZZAF 10


Functions in python

04/10/2025 Mohamed RHAZZAF 11


Packages in python

• No need to reinvent the wheel


• A set of folders and/or files with multiple prepared functions
• Optimal implementation (with error management)
• Optimal performance
• User friendly interfaces
• Different disciplines:
– Network
– Cyphering
– Scientific calculation
– Engineering
– Machine learning

04/10/2025 Mohamed RHAZZAF 12


Usage of packages in python

• In order to use a python package:


– Download the package if you don’t have it inside your PC
– Import the package in your code
– Use the function of the package

04/10/2025 Mohamed RHAZZAF 13


Usage of packages in python

04/10/2025 Mohamed RHAZZAF 14


Native types in python

• String manipulation

04/10/2025 Mohamed RHAZZAF 15


Native types in python

• Array manipulation

04/10/2025 Mohamed RHAZZAF 16


Native types in python

• Dictionary manipulation

04/10/2025 Mohamed RHAZZAF 17

You might also like