Introduction to
Programming in
Python3.x
Python3
Python3
Python3
Project Datatypes
OOP Operators
Modules Decision Statement
Functions Loops
File manipulation Control statements
Your First Program
• Python script – text file with ‘.py’ extension.
• Can be opened by any text editor.
• Filename has restrictions
• Can only use alpha-numerics, underscores,
hyphen and period.
• Cannot start with a digit
• No other special characters.
• Special words – reserved for pythons usage.
• Look at some of them and their uses as we move
forward.
• “print” is one such word.
• Commenting the code is an essential skill.
• # indicates comment – wont be read by the
interpreter
• ‘’’ ‘’’ – multi line comment
Your First Program
Python3
Project Datatypes
OOP Operators
Modules Decision Statement
Functions Loops
File manipulation Control statements
Datatypes
What are we going to do?
On an very simple language
•Work with numbers (Both integers and floats)
•Work with alphabets
•Read & write data from and into files (Eg: images, text files, stl files, etc…)
To do that we follow certain rules and regulations. We call them as syntax.
Each language has its own syntax, but the basic logic behind them is almost similar to each
other.
Datatypes
Numeric - Integer, Floats, Complex Numbers
String - Alphabets
Boolean - True or False
Sequence - List , Tuple
Mapped Data - Dictionary
Binary Data - bytes, bytearray
Datatypes > Numeric
•Variables – like postal addresses in a village
•Variable – name for the location in memory
•Types of numbers
•Integers
•Floats
•Complex Numbers
•Complex implementation uses only ‘j’
•No space between the imginary No. and ‘j’
Datatypes
Numeric - Integer, Floats, Complex Numbers
String - Alphabets
Boolean - True or False
Sequence - List , Tuple
Mapped Data - Dictionary
Binary Data - bytes, bytearray
Datatypes > String
Datatypes
Numeric - Integer, Floats, Complex Numbers
String - Alphabets
Boolean - True or False
Sequence - List , Tuple
Mapped Data - Dictionary
Binary Data - bytes, bytearray
Datatypes > Boolean
Datatypes
Numeric - Integer, Floats, Complex Numbers
String - Alphabets
Boolean - True or False
Sequence - List , Tuple
Mapped Data - Dictionary
Binary Data - bytes, bytearray
Datatypes > Numeric String Boolean
Datatypes > Numeric String Boolean
Datatypes
Numeric - Integer, Floats, Complex Numbers
String - Alphabets
Boolean - True or False
Sequence - List , Tuple
Mapped Data - Dictionary
Binary Data - bytes, bytearray
Datatypes > List
Datatypes > List
Datatypes > Tuple
Datatypes > Tuple
Datatypes
Numeric - Integer, Floats, Complex Numbers
String - Alphabets
Boolean - True or False
Sequence - List , Tuple
Mapped Data - Dictionary
Binary Data - bytes, bytearray
Datatypes > Mapped Data
Datatypes > Mapped Data
Datatypes
Numeric - Integer, Floats, Complex Numbers
String - Alphabets
Boolean - True or False
Sequence - List , Tuple
Mapped Data - Dictionary
Binary Data - bytes, bytearray
Python3
Project Datatypes
OOP Operators
Modules Decision Statement
Functions Loops
File manipulation Control statements
Operators
Arithmetic Operator
Assignment Operator
Comparison Operator
Logical Operator
Bitwise Operator
Identity Operator
Operators > Arithmetic Operator
Operators > Arithmetic Operator
Operators > Assignment Operator
Operators > Assignment Operator
Operators > Comparison Operator
Operators > Comparison Operator
Operators
Arithmetic Operator
Assignment Operator
Comparison Operator
Logical Operator
Bitwise Operator
Identity Operator
Python3
Project Datatypes
OOP Operators
Modules Decision Statement
Functions Loops
File manipulation Control statements
Decision Statement
Decision Statement
Decision Statement
Python3
Project Datatypes
OOP Operators
Modules Decision Statement
Functions Loops
File manipulation Control statements
Loops > ‘for’
Loops > ‘for’
Loops > ‘while’
Loops > ‘while’
Python3
Project Datatypes
OOP Operators
File manipulation Decision Statement
Modules Loops
Functions Control statements
Python3
Python3
Project Datatypes
OOP Operators
File manipulation Decision Statement
Modules Loops
Functions Control statements
Python3 > Functions
Python3 > Functions
Python3
Project Datatypes
OOP Operators
File manipulation Decision Statement
Modules Loops
Functions Control statements
Python3 > Modules
Python3 > Modules
Python3
Project Datatypes
OOP Operators
File manipulation Decision Statement
Modules Loops
Functions Control statements