INTRODUCTION
TO PYTHON
02
General-purpose
programming language.
CONTENT OF THIS COURSE
Here’s what you’ll find in this Course :
● Introduction to python general-purpose programming language.
● What Python Used for.
● Companies uses Python.
● Setting Up the Environment.
● Start Python Programming
Introduction to AI with ML
What Python is?
Python is a popular general-purpose programming language.
It was created by Guido van Rossum in 1980, and released in 1991.
It is used for:
 Web development (server-side).
 Artificial Intelligence .
 Software Development.
Introduction to AI with ML
General Vs Specific Purpose
Introduction to AI with ML
What Python is?
Python is a popular general-purpose programming language.
It was created by Guido van Rossum in 1980, and released in 1991.
It is used for:
 Web development (server-side).
 Artificial Intelligence .
 Software Development.
Introduction to AI with ML
Top Companies using python
Introduction to AI with ML
What make it so powerful for that is
because it has a many framework!
A framework is a set structure in which tasks are performed or completed.
Typically, a framework refers to an often layered structure that indicates what
kind of programs can or should be built and how they would connect to each
other.
Introduction to AI with ML
Setting up the Enviroment
Introduction to AI with ML
An integrated development environment (IDE)
Introduction to AI with ML
Why it’s better to use an IDE than
Running code in Note pad with python
Compiler
Introduction to AI with ML
Functions
Introduction to AI with ML
WHAT DOES A COMPUTER DO?
 performs calculations a billion calculations per second! two
operations in same time light travels 1 foot.
 Remembers results
100s of gigabytes of storage!
typical machine could hold 1.5M books of standard size
-Linus Torvalds
“Talk is cheap.
Show me the code.”
Introduction to AI with ML
02:Variables
Introduction to AI with ML
Variables
You can think of variable as a little box or a container to store
data in the memory of the computer and later retrieve the data
using the variable “name”
Programmers get to choose the names of the variables
You can change the contents of a variable in a later statement
Introduction to AI with ML
02:Variables
Introduction to AI with ML
02:Variables
Introduction to AI with ML
Arian 5 the worst bug disaster
On June 4th, 1996, the very first Ariane 5 rocket ignited its engines and began
speeding away from the coast of French Guiana. 37 seconds later, the rocket flipped
90 degrees in the wrong direction, and less than two seconds later, aerodynamic
forces ripped the boosters apart from the main stage at a height of 4km.
Introduction to AI with ML
Introduction to AI with ML
01:Arithmetic Operations
Operation
Operator
Addition
+
Subtraction
-
Multiplication
*
Division
/
Power
**
Remainder
%
Introduction to AI with ML
03:User Input
Python has an input function which lets you ask a user for some
text input.
Introduction to AI with ML
04:Comments in Python
Comments in Python begin with a hash mark ( # ) and whitespace character
and continue to the end of the line. Because comments do not execute,
when you run a program you will not see any indication of
the comment there. Comments are in the source code for humans to read,
not for computers to execute.
Introduction to AI with ML
05:Conditions
Python uses boolean logic to evaluate conditions. The boolean values True and
False are returned when an expression is compared or evaluated.
Introduction to AI with ML
Introduction to AI with ML
Introduction to AI with ML
06:Loop
Python has two primitive loop commands:
 while loops
 for loops
Introduction to AI with ML
07:Data Structures
• Every child knows that one can – at least beyond a certain number – find things much easier
if one keeps order. We humans understand by keeping things in order that we separate the
things that we possess into categories and assign fixed locations to these categories that we
can remember.
• We may simply throw socks into a drawer, but for other things like DVDs it is best to sort
them beyond a certain number so that we can quickly find every DVD.
Introduction to AI with ML
Introduction to AI with ML
07:Data Structures-String
What If I told u there is no Variable called string
Introduction to AI with ML
07:Data Structures-String
A L M E N T O R
Introduction to AI with ML
07:Data Structures
There are four collection data types in the Python programming language:
List is a collection which is ordered and changeable. Allows duplicate members.
Tuple is a collection which is ordered and unchangeable. Allows duplicate
members.
Set is a collection which is unordered and unindexed. No duplicate members.
Dictionary is a collection which is ordered* and changeable. No duplicate
members.
Introduction to AI with ML
07:Data Structures-List
 Lists are used to store multiple items in a single variable.
 Lists are one of 4 built-in data types in Python used to store collections
of data, the other 3 are Tuple, Set, and Dictionary, all with different
qualities and usage.
 The list is changeable, meaning that we can change, add, and remove
items in a list after it has been created.
 Lists are created using square brackets:
Introduction to AI with ML
07:Data Structures-Tuples
 Tuples are used to store multiple items in a single variable.
 Tuple is one of 4 built-in data types in Python used to store collections
of data, the other 3 are List, Set, and Dictionary, all with different
qualities and usage.
 A tuple is a collection which is ordered and unchangeable.
 Tuples are written with round brackets.
Introduction to AI with ML
07:Data Structures-Sets
 Sets are used to store multiple items in a single variable.
 Set is one of 4 built-in data types in Python used to store collections of
data, the other 3 are List, Tuple, and Dictionary, all with different
qualities and usage.
 A set is a collection which is both unordered and unindexed.
 Sets are written with curly brackets.
Introduction to AI with ML
07:Data Structures-Sets
 You cannot access items in a set by referring to an index or a key.
 But you can loop through the set items using a for loop, or ask if a
specified value is present in a set, by using the in keyword.
 Once a set is created, you cannot change its items, but you can add new
items.
 To add one item to a set use the add() method.
 To remove an item in a set, use the remove(), or the discard() method.
Introduction to AI with ML
07:Data Structures-Sets
Introduction to AI with ML
07:Data Structures-DICT
 Dictionaries are used to store data values in key:value pairs.
 A dictionary is a collection which is ordered*, changeable and does not
allow duplicates.
 We use it to create JSON APIS.
Introduction to AI with ML
07:Data Structures-DICT
 You can access the items of a dictionary by referring to its key
name, inside square brackets:
 Update the "year" of the car by using the update() method:
Introduction to AI with ML
07:Pandas data frame
The Pandas DataFrame is a structure that contains two-dimensional data and its
corresponding labels. DataFrames are widely used in data science, machine learning,
scientific computing, and many other data-intensive fields. DataFrames are similar to
SQL tables or the spreadsheets that you work with in Excel or Calc.
Introduction to AI with ML
08:Functions
Introduction to AI with ML
08:Functions
A function is a block of code which only runs when it is called.
You can pass data, known as parameters, into a function.
A function can return data as a result.
Introduction to AI with ML
09:Object Oriented Programming
Object-oriented programming (OOP) is a programming paradigm based on the
concept of "objects", which can contain data and code: data in the form of fields
(often known as attributes or properties), and code, in the form of procedures
(often known as methods).
Introduction to AI with ML
09:Object Oriented Programming
Introduction to AI with ML
09:Object Oriented Programming
Name
Attributes
Actions
Introduction to AI with ML
09:Object Oriented Programming
A class is an extensible program-code-template for creating objects, although a very
tiny application might need just a single class. The class must go within a pair of curly
braces.
Introduction to AI with ML
Class design like Blueprint architecture
Introduction to AI with ML
Class design
Introduction to AI with ML
Class design
Introduction to AI with ML
09:Object Oriented Programming provide
code reuse
 Code reuse is the practice of using existing code for a new function or
software.
 This saves time, improves the features in your program, and generally makes
for more cost-effective programming. Reusability is an important issue in
software engineering.
Introduction to AI with ML
09:Object Oriented Programming
Class
Jeep
Honda
Nissan
Mercedes
Car
Introduction to AI with ML
09:Object Oriented Programming provide
code reuse
 Code reuse is the practice of using existing code for a new function or
software.
 This saves time, improves the features in your program, and generally makes
for more cost-effective programming. Reusability is an important issue in
software engineering.
Introduction to AI with ML
09:Object Oriented Programming-
provide Inheritance
Introduction to AI with ML
Create Class using unified modeling
language UML

Part 2 Python

  • 1.
  • 2.
    CONTENT OF THISCOURSE Here’s what you’ll find in this Course : ● Introduction to python general-purpose programming language. ● What Python Used for. ● Companies uses Python. ● Setting Up the Environment. ● Start Python Programming
  • 3.
    Introduction to AIwith ML What Python is? Python is a popular general-purpose programming language. It was created by Guido van Rossum in 1980, and released in 1991. It is used for:  Web development (server-side).  Artificial Intelligence .  Software Development.
  • 4.
    Introduction to AIwith ML General Vs Specific Purpose
  • 5.
    Introduction to AIwith ML What Python is? Python is a popular general-purpose programming language. It was created by Guido van Rossum in 1980, and released in 1991. It is used for:  Web development (server-side).  Artificial Intelligence .  Software Development.
  • 11.
    Introduction to AIwith ML Top Companies using python
  • 12.
    Introduction to AIwith ML What make it so powerful for that is because it has a many framework! A framework is a set structure in which tasks are performed or completed. Typically, a framework refers to an often layered structure that indicates what kind of programs can or should be built and how they would connect to each other.
  • 13.
    Introduction to AIwith ML Setting up the Enviroment
  • 14.
    Introduction to AIwith ML An integrated development environment (IDE)
  • 15.
    Introduction to AIwith ML Why it’s better to use an IDE than Running code in Note pad with python Compiler
  • 16.
    Introduction to AIwith ML Functions
  • 17.
    Introduction to AIwith ML WHAT DOES A COMPUTER DO?  performs calculations a billion calculations per second! two operations in same time light travels 1 foot.  Remembers results 100s of gigabytes of storage! typical machine could hold 1.5M books of standard size
  • 18.
    -Linus Torvalds “Talk ischeap. Show me the code.”
  • 19.
    Introduction to AIwith ML 02:Variables
  • 20.
    Introduction to AIwith ML Variables You can think of variable as a little box or a container to store data in the memory of the computer and later retrieve the data using the variable “name” Programmers get to choose the names of the variables You can change the contents of a variable in a later statement
  • 21.
    Introduction to AIwith ML 02:Variables
  • 22.
    Introduction to AIwith ML 02:Variables
  • 23.
    Introduction to AIwith ML Arian 5 the worst bug disaster On June 4th, 1996, the very first Ariane 5 rocket ignited its engines and began speeding away from the coast of French Guiana. 37 seconds later, the rocket flipped 90 degrees in the wrong direction, and less than two seconds later, aerodynamic forces ripped the boosters apart from the main stage at a height of 4km.
  • 24.
  • 25.
    Introduction to AIwith ML 01:Arithmetic Operations Operation Operator Addition + Subtraction - Multiplication * Division / Power ** Remainder %
  • 26.
    Introduction to AIwith ML 03:User Input Python has an input function which lets you ask a user for some text input.
  • 27.
    Introduction to AIwith ML 04:Comments in Python Comments in Python begin with a hash mark ( # ) and whitespace character and continue to the end of the line. Because comments do not execute, when you run a program you will not see any indication of the comment there. Comments are in the source code for humans to read, not for computers to execute.
  • 28.
    Introduction to AIwith ML 05:Conditions Python uses boolean logic to evaluate conditions. The boolean values True and False are returned when an expression is compared or evaluated.
  • 29.
  • 30.
  • 31.
    Introduction to AIwith ML 06:Loop Python has two primitive loop commands:  while loops  for loops
  • 32.
    Introduction to AIwith ML 07:Data Structures • Every child knows that one can – at least beyond a certain number – find things much easier if one keeps order. We humans understand by keeping things in order that we separate the things that we possess into categories and assign fixed locations to these categories that we can remember. • We may simply throw socks into a drawer, but for other things like DVDs it is best to sort them beyond a certain number so that we can quickly find every DVD.
  • 33.
  • 34.
    Introduction to AIwith ML 07:Data Structures-String What If I told u there is no Variable called string
  • 35.
    Introduction to AIwith ML 07:Data Structures-String A L M E N T O R
  • 36.
    Introduction to AIwith ML 07:Data Structures There are four collection data types in the Python programming language: List is a collection which is ordered and changeable. Allows duplicate members. Tuple is a collection which is ordered and unchangeable. Allows duplicate members. Set is a collection which is unordered and unindexed. No duplicate members. Dictionary is a collection which is ordered* and changeable. No duplicate members.
  • 37.
    Introduction to AIwith ML 07:Data Structures-List  Lists are used to store multiple items in a single variable.  Lists are one of 4 built-in data types in Python used to store collections of data, the other 3 are Tuple, Set, and Dictionary, all with different qualities and usage.  The list is changeable, meaning that we can change, add, and remove items in a list after it has been created.  Lists are created using square brackets:
  • 38.
    Introduction to AIwith ML 07:Data Structures-Tuples  Tuples are used to store multiple items in a single variable.  Tuple is one of 4 built-in data types in Python used to store collections of data, the other 3 are List, Set, and Dictionary, all with different qualities and usage.  A tuple is a collection which is ordered and unchangeable.  Tuples are written with round brackets.
  • 39.
    Introduction to AIwith ML 07:Data Structures-Sets  Sets are used to store multiple items in a single variable.  Set is one of 4 built-in data types in Python used to store collections of data, the other 3 are List, Tuple, and Dictionary, all with different qualities and usage.  A set is a collection which is both unordered and unindexed.  Sets are written with curly brackets.
  • 40.
    Introduction to AIwith ML 07:Data Structures-Sets  You cannot access items in a set by referring to an index or a key.  But you can loop through the set items using a for loop, or ask if a specified value is present in a set, by using the in keyword.  Once a set is created, you cannot change its items, but you can add new items.  To add one item to a set use the add() method.  To remove an item in a set, use the remove(), or the discard() method.
  • 41.
    Introduction to AIwith ML 07:Data Structures-Sets
  • 42.
    Introduction to AIwith ML 07:Data Structures-DICT  Dictionaries are used to store data values in key:value pairs.  A dictionary is a collection which is ordered*, changeable and does not allow duplicates.  We use it to create JSON APIS.
  • 43.
    Introduction to AIwith ML 07:Data Structures-DICT  You can access the items of a dictionary by referring to its key name, inside square brackets:  Update the "year" of the car by using the update() method:
  • 44.
    Introduction to AIwith ML 07:Pandas data frame The Pandas DataFrame is a structure that contains two-dimensional data and its corresponding labels. DataFrames are widely used in data science, machine learning, scientific computing, and many other data-intensive fields. DataFrames are similar to SQL tables or the spreadsheets that you work with in Excel or Calc.
  • 45.
    Introduction to AIwith ML 08:Functions
  • 46.
    Introduction to AIwith ML 08:Functions A function is a block of code which only runs when it is called. You can pass data, known as parameters, into a function. A function can return data as a result.
  • 47.
    Introduction to AIwith ML 09:Object Oriented Programming Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code: data in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods).
  • 48.
    Introduction to AIwith ML 09:Object Oriented Programming
  • 49.
    Introduction to AIwith ML 09:Object Oriented Programming Name Attributes Actions
  • 50.
    Introduction to AIwith ML 09:Object Oriented Programming A class is an extensible program-code-template for creating objects, although a very tiny application might need just a single class. The class must go within a pair of curly braces.
  • 51.
    Introduction to AIwith ML Class design like Blueprint architecture
  • 52.
    Introduction to AIwith ML Class design
  • 53.
    Introduction to AIwith ML Class design
  • 54.
    Introduction to AIwith ML 09:Object Oriented Programming provide code reuse  Code reuse is the practice of using existing code for a new function or software.  This saves time, improves the features in your program, and generally makes for more cost-effective programming. Reusability is an important issue in software engineering.
  • 55.
    Introduction to AIwith ML 09:Object Oriented Programming Class Jeep Honda Nissan Mercedes Car
  • 56.
    Introduction to AIwith ML 09:Object Oriented Programming provide code reuse  Code reuse is the practice of using existing code for a new function or software.  This saves time, improves the features in your program, and generally makes for more cost-effective programming. Reusability is an important issue in software engineering.
  • 57.
    Introduction to AIwith ML 09:Object Oriented Programming- provide Inheritance
  • 58.
    Introduction to AIwith ML Create Class using unified modeling language UML