Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
9 views

Python

This document provides an introduction to Python programming, covering key concepts like data types, variables, operators, conditionals, loops, data structures, functions, and connecting Python to linear algebra. It discusses how Python is easy to learn and read, versatile, and has extensive libraries. It defines variables and assigning values, describes arithmetic, comparison, logical, and assignment operators, and shows examples of if/else conditional statements, for/while loops, and nested loops. It also covers built-in data structures like lists, tuples, dictionaries, strings, and sets, as well as how to define functions and connect Python to linear algebra by writing code to convert a matrix to reduced echelon form.

Uploaded by

sahardevjani635
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Python

This document provides an introduction to Python programming, covering key concepts like data types, variables, operators, conditionals, loops, data structures, functions, and connecting Python to linear algebra. It discusses how Python is easy to learn and read, versatile, and has extensive libraries. It defines variables and assigning values, describes arithmetic, comparison, logical, and assignment operators, and shows examples of if/else conditional statements, for/while loops, and nested loops. It also covers built-in data structures like lists, tuples, dictionaries, strings, and sets, as well as how to define functions and connect Python to linear algebra by writing code to convert a matrix to reduced echelon form.

Uploaded by

sahardevjani635
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 35

PYTHON PROGRAMMING

Sahar Fatima Devjani


2

CONTENTS
o Why Python?

o Data Types

o Operators

o Conditionals

o Loops

o Data Structures

o Functions

o Connecting Python to Linear Algebra


WHY PYTHON?

• Easy to Learn and Read


• Versatile and General-Purpose
• Extensive Libraries and Frameworks
A BASIC PROGRAM IN PYTHON

Code:

Output:
D ATA T Y P E S
In Python, data types define the nature of values a
variable can hold, such as integers, floats, or strings.
offering flexibility and ease of use.
VA R I A B L E S
A variable is a container that holds or stores data. It
provides a named reference to a value, making it
easier to manipulate and work with that data within a
program.
7

M A K I N G VA R I A B L E S A N D A S S I G N I N G
VA L U E S
O P E R AT O R S I N P Y T H O N

• Arithmetic Operators
• Comparison Operators
• Logical Operators
• Assignment Operators
9

A R I T H M E T I C O P E R AT O R S
10

C O M PA R I S O N O P E R AT O R S
11

A S S I G N M E N T O P E R AT O R S
12

L O G I C A L O P E R AT O R S
CONDITIONALS IN
PYTHON

• IF
• IF ELSE
• IF ELIF ELSE
• NESTED CONDITIONALS
14

IF
15

IF ELSE
16

IF ELIF ELSE
17

NESTED CONDITIONALS
TYPES OF LOOPS

For Loop While Loop Nested Loops

The "for" loop is used to iterate over a The "while" loop is used to repeatedly Authenticates ownership of specific
sequence (such as a list, tuple, string, or execute a block of code as long as a assets
range) and execute a block of code for specified condition is true.
each element in the sequence.
19

FOR LOOP
20

WHILE
LOOP
21

NESTED LOOPS
D ATA S T R U C T U R E S
Tuples Dictionary Strings

Ordered collection of item Collection of key value pairs. A sequence of characters.


immutable Mutable Immutable.
Created using parenthesis (). Formed using curly brackets {}. Created using single (‘) or double (“)
quotes.

Lists Array Sets

Ordered collection of item Homogeneous collection of data. unordered collection of item


Mutable More memory efficient. Mutable
Created using square brackets [] Created using Created using curly brackets {}.
23

LISTS
24

A R R AY
25

SETS
26

TUPLES
27

D I CT I O NARY
28

STRINGS
FUNCTIONS
In Python, a function is a block of reusable code
designed to perform a specific task. Functions are
defined using the def keyword, and they can take
parameters (inputs), perform a set of operations, and
return a result.
C O N N E C T I N G P Y T H O N TO L I N E A R
A LG E B R A

I have made a code to convert a matrix to reduced


echelon form
OUTPU
T
THANK YOU
Any Questions ?

You might also like