This document provides an introduction to Python programming. It discusses that Python is a popular general-purpose programming language created by Guido van Rossum in 1980. It is used for web development, artificial intelligence, and software development. The document then covers setting up the Python environment, variables, data types, control flow, functions, object-oriented programming and classes.
2. 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
3. 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.
5. 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.
12. 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.
17. 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
20. 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
23. 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.
25. Introduction to AI with ML
01:Arithmetic Operations
Operation
Operator
Addition
+
Subtraction
-
Multiplication
*
Division
/
Power
**
Remainder
%
26. Introduction to AI with ML
03:User Input
Python has an input function which lets you ask a user for some
text input.
27. 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.
28. 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.
31. Introduction to AI with ML
06:Loop
Python has two primitive loop commands:
while loops
for loops
32. 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.
36. 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.
37. 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:
38. 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.
39. 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.
40. 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.
42. 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.
43. 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:
44. 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.
46. 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.
47. 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).
49. Introduction to AI with ML
09:Object Oriented Programming
Name
Attributes
Actions
50. 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.
54. 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.
55. Introduction to AI with ML
09:Object Oriented Programming
Class
Jeep
Honda
Nissan
Mercedes
Car
56. 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.
57. Introduction to AI with ML
09:Object Oriented Programming-
provide Inheritance
58. Introduction to AI with ML
Create Class using unified modeling
language UML