Python - Lesson 1
Python - Lesson 1
02 04
Function Pandas
MODULE 1.
INTRODUCTION TO
PYTHON
Module 1:INTRODUCTION TO PYTHON
Introduction to Python
Basic syntax
Decision Making
Loops
Introduction to Python
Module 1: INTRODUCTION TO PYTHON
Why Python?
• Solve complex problems in less time with fewer lines of code.
• High-level
• Cross-platform
• Huge Community
• Large Ecosystem
Module 1: INTRODUCTION TO PYTHON
Programing Modes?
• Interactive Mode
• Script Mode
Basic syntax
Module 1: INTRODUCTION TO PYTHON
Identifiers
Reserved Words
and exec not
assert finally or
break for pass
class from print
continue global raise
def if return
del import try
elif in while
else is with
except lambda yield
Module 1: INTRODUCTION TO PYTHON
Comments
A hash sign (#) starts a comment
Module 1: INTRODUCTION TO PYTHON
Variables
• Variables are reserved memory locations to store values.
• Python variables do not need explicit declaration to reserve memory space
• The declaration is automatically when you assign a value to a variable by using the equal sign (=)
• Could assign a single value to several variables simultaneously
• Could assign multiple objects to multiple variables.
Module 1: INTRODUCTION TO PYTHON
Input/Output operators
• Input and output (I/O) operators are used to take input and display output
Module 1: INTRODUCTION TO PYTHON
Data Types
• Numbers: 5, 4.2, …
• String: “Hello world”, …
• List: [1,2,3,4], [“abc”,”xyz”,123]
• Tuple: (1,2,3,4)
• Dictionary: {‘a’: 1, ‘b’: 2}
• Set
Module 1: INTRODUCTION TO PYTHON
IF Statement
Module 1: INTRODUCTION TO PYTHON
IF Statement
if expression1:
statement(s)
elif expression2:
statement(s)
elif expression3:
statement(s)
else:
statement(s)
Module 1: INTRODUCTION TO PYTHON
AND – OR – NOT
A B A AND B A OR B NOT A
For Loop
for <var> in <iterable>:
<statement(s)>
Module 1: INTRODUCTION TO PYTHON
While Loop
while <condition>:
<statement(s)>
Module 1: INTRODUCTION TO PYTHON