0% found this document useful (0 votes)
9 views242 pages

Python Full Notes

Python is an interpreted, object-oriented programming language known for its easy syntax and dynamic semantics, invented by Guido van Rossum and first released on February 20, 1991. It supports various applications such as web development, game development, machine learning, and data analysis, and is used by companies like NASA and Netflix. The document also covers algorithms, flowcharts, variables, data types, and operators in Python.

Uploaded by

raunaknirmal9250
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views242 pages

Python Full Notes

Python is an interpreted, object-oriented programming language known for its easy syntax and dynamic semantics, invented by Guido van Rossum and first released on February 20, 1991. It supports various applications such as web development, game development, machine learning, and data analysis, and is used by companies like NASA and Netflix. The document also covers algorithms, flowcharts, variables, data types, and operators in Python.

Uploaded by

raunaknirmal9250
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 242

WHAT IS PYTHON

Python is interpreted, object-oriented, high-


level programming language with dynamic
semantics.
Python syntex are easy compared to other
languges
2 FIRST RELEASED

HISTORY
February 20, 1991

1 INVENTED BY 3 LATEST VERSION

Guido van Rossum


Python 3.9.8
in 1989
PYTHON FEATURES
EASY PORTABLE

GUI SUPPORTS

FREE AND OPEN LARGE PYTHON


SOURCE LIBRARY
APPLICATIONS OF PYTHON
[Link] A WEBSITE USING PYTHON
[Link] A GAME IN PYTHON
[Link] MACHINE LEARNING
[Link] ROBOTICS WITH PYTHON
[Link] DATA ANALYSIS USING PYTHON
[Link] ARTIFICIAL INTELLIGENCE
[Link] A WEB BROWSER
COMPANIES USING PYTHON
NASA
Netflix

Intel

Facebook
IBM
CHAPTER-1

INTRODUCTION
TO
PROGRAMMING
Presented by Computer G
WHAT IS AN ALGORITHM?
In computer programming terms, an algorithm
is a set of well-defined instructions to solve a
particular problem.
The word Algorithm means ”A set of finite rules
or instructions to be followed in calculations or
other problem-solving operations ”
ALGORITHM TO ADD TWO NUMBERS
Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values for num1, num2.
Step 4: Add num1 and num2 and assign the result
to a variable sum.
Step 5: Display sum
Step 6: Stop
FLOWCHART
A flowchart is a type of diagram that
represents a workflow or process. A flowchart
can also be defined as a diagrammatic
representation of an algorithm, a step-by-step
approach to solving a task.
PROGRAMMING LANGUAGE
A programming language is a computer
language that is used by programmers
(developers) to communicate with computers.
It is a set of instructions written in any
specific language ( C, C++, Java, Python) to
perform a specific task.
MOST COMMONLY USED PROGRAMMING
LANGUAGE
1. Python 5. C#
2. Java 6. JavaScript
3. C 7. R
4. C++ 8. PHp
WHAT IS TESTING?
Testing is the process of verifying and validating
that a software or application is bug-free, meets
the technical requirements as guided by its design
and development, and meets the user
requirements effectively and efficiently by
handling all the exceptional and boundary cases.
WHAT IS DEBUGGING?
Debugging is the process of fixing a bug in the
software. It can be defined as identifying,
analyzing, and removing errors.
CHAPTER-2

ALGORITHM
&
FLOWCHARTS
Presented by Computer G
WHAT IS AN ALGORITHM?
In computer programming terms, an algorithm
is a set of well-defined instructions to solve a
particular problem.
The word Algorithm means ”A set of finite rules
or instructions to be followed in calculations or
other problem-solving operations ”
FLOWCHART
A flowchart is a type of diagram that
represents a workflow or process. A flowchart
can also be defined as a diagrammatic
representation of an algorithm, a step-by-step
approach to solving a task.
ADD TWO NUMBERS
ALGORITHM TO ADD TWO NUMBERS
Step 1: Start
Step 2: Declare variables A, B and C.
Step 3: Read values for A, B.
Step 4: Add A and B and assign the result to a
variable C.
Step 5: Display sum
Step 6: Stop
Determining the Largest
Number Among All the
Entered Integers
ALGORITHM

Step 1: Read the Integer A.


Step 2: Read Integer B.
Step 3: Compare A and B
Step 4: If B is greater than A, then print B, else
A.
Determine and Output
Whether Number N is Even
or Odd
ALGORITHM

Step 1: Read number N.


Step 2: Set remainder as N modulo 2.
Step 3: If the remainder is equal to 0, then
number N is even, else number N is odd.
Step 4: Print output.
Calculate the Interest of
a Bank Deposit
ALGORITHM
Step 1: Read amount.
Step 2: Read years.
Step 3: Read rate.
Step 4: Calculate the interest with the formula
"Interest=Amount*Years*Rate/100.
Step 5: Print interest.
CHAPTER-3

VARIABLES
&
COMMENTS
Presented by Computer G
VARIABLES
Variables are containers for storing data values.
Unlike other programming languages, Python has no
command for declaring a variable.
A variable is created the moment you first assign a value
to it. Example
x=5
y = "John"
print(x)
print(y)
Variables do not need to be declared with any particular
type and can even change type after they have been
set. Example
x = 4 # x is of type int
x = "Sally" # x is now of type str
print(x)
String variables can be declared either by using single
or double quotes:
Example
x = "John" # is the same as
x = 'John'
VARIABLE NAMES
A variable can have a short name (like x and y) or a more
descriptive name (age, carname, total_volume).
Rules for Python variables:
 A variable name must start with a letter or the underscore
character
 A variable name cannot start with a number
 A variable name can only contain alpha-numeric characters and
underscores (A-z, 0-9, and _ )
 Variable names are case-sensitive (age, Age and AGE are
three different variables)
Remember that variable names are case-sensitive
ASSIGN VALUE TO MULTIPLE VARIABLES
Python allows you to assign values to multiple variables in one line:
Example
x, y, z = "Orange", "Banana", "Cherry"
print(x)
print(y)
print(z)
And you can assign the same value to multiple variables in one line:
Example
x = y = z = "Orange"
print(x)
print(y)
print(z)
ASSIGN VALUE TO MULTIPLE VARIABLES
The Python print statement is often used to output variables.
To combine both text and a variable, Python uses the +
character: Example
x = "awesome"
print("Python is " + x)
You can also use the + character to add a variable to
another variable: Example
x = "Python is "
y = "awesome"
z=x+y
print(z)
ASSIGN VALUE TO MULTIPLE VARIABLES
If you try to combine a string and a number, Python will give
you an error:
Example
x=5
y = "John"
print(x + y)
COMMENTS
Creating a Comment Comments starts with a #, and Python
will ignore them: Example
#This is a comment
print("Hello, World!")
Comments can be placed at the end of a line, and Python
will ignore the rest of the line: Example
print("Hello, World!")
#This is a comment
Comments does not have to be text to explain the code, it
can also be used to prevent Python from executing code:
MULTI LINE COMMENTS
Python does not really have a syntax for multi line
comments.
To add a multiline comment you could insert a # for
each line: Example
#This is a comment
#written in
#more than just one line
print("Hello, World!")
Or, not quite as intended, you can use a multiline string.
MULTI LINE COMMENTS
Since Python will ignore string literals that are not
assigned to a variable, you can add a multiline string (triple
quotes) in your code, and place you comment inside it:
Example
"""
This is a comment
written in
more than just one line
"""
print("Hello, World!")
PYTHON

LECTURE-7
Presented by Computer G
PYTHON NUMBERS

There are three numeric types in Python:


int
float
complex
Variables of numeric types are created when you assign
a value to them: Example
x = 1 # int
y = 2.8 # float
z = 1j # complex
print(type(x))
print(type(y))
print(type(z))
To verify the type of any object in Python, use the type()
function:
Int:-
Int, or integer, is a whole number, positive
or negative, without decimals, of unlimited
length. Example Integers:
x=1
y = 35656222554887711
z = -3255522
Float:-
Float, or "floating point number" is a number, positive or
negative, containing one or more decimals. Example-
Floats:
x = 1.10
y = 1.0
z = -35.59
i = 35e3
j = 12E4
k = -87.7e100
Float can also be scientific numbers with an "e" to indicate the
power of 10.
Complex:-
Complex numbers are written with a "j" as the
imaginary part: Example Complex:
x = 3+5j
y = 5j
z = -5j
TYPE CONVERSION
You can convert from one type to another with the int(), float(), and
complex() methods: Example
Convert from one type to another:
x = 1 # int
y = 2.8 # float
z = 1j # complex
#convert from int to float:
a = float(x)
#convert from float to int:
b = int(y)
#convert from int to complex:
c = complex(x)
print(a)
print(b)
print(c)
print(type(a))
print(type(b))
print(type(c))
Note: You cannot convert complex numbers
into another number type.
STRING LITERALS
String literals in python are surrounded by either
single quotation marks, or double quotation
marks.
'hello' is the same as "hello".
You can display a string literal with the print()
function: Example
print("Hello")
print('Hello')
ASSIGN STRING TO A VARIABLE
Assigning a string to a variable is done with
the variable name followed by an equal sign
and the string:
Example
a = "Hello"
print(a)
MULTILINE STRINGS
You can assign a multiline string to a variable by using three
quotes: Example
You can use three double quotes:
a = """Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua."""
print(a)
Or three single quotes: Note: in the result, the line breaks
are inserted at the same position as in the code.
PYTHON CONSTANTS
Sometimes, you may want to store values in variables. But you don’t
want to change these values throughout the execution of the program.
To do it in other programming languages, you can use constants. The
constants like variables but their values don’t change during the
program executes.
The bad news is that Python doesn’t support constants.
To work around this, you use all capital letters to name a variable to
indicate that the variable should be treated as a constant. For
example: MY_PHONE_NUMBER = 9100000000
When encountering variables like these, you should not change their
values. These variables are constant by convention, not by rules.
PYTHON

LECTURE-8
Presented by Computer G
STRINGS ARE ARRAYS
Like many other popular programming languages,
strings in Python are arrays of bytes representing
Unicode characters.
However, Python does not have a character data
type, a single character is simply a string with a
length of 1. Square brackets can be used to access
elements of the string
Example Get the character at position 1
(remember that the first character has the
position 0):
a = "Hello, World!"
print(a[1]) # returns "e"
Example Substring. Get the characters
from position 2 to position 5 (5 position not
included):
b = "Hello, World!"
print(b[2:5]) # returns "llo"
print(b[Link]) # returns "lo"
print(b[::-1]) # returns "!dlroW ,olleH"
METHOD IN STRING
Example The strip() method removes any whitespace
from the beginning or the end:
a = " Hello, World! "
print([Link]()) # returns "Hello, World!"
print([Link]()) # returns "Hello, World! "
Removes any whitespace from the beginning.
print([Link]()) # returns " Hello, World!"
Removes any whitespace from the end
Example The len() method returns the length
of a string:
a = "Hello, World!"
print(len(a)) # returns 13
Example The lower() method returns the
string in lower case:
a = "Hello, World!"
print([Link]())# returns "hello, world!"
Example The upper() method returns the
string in upper case:
a = "Hello, World!"
print([Link]())# returns "HELLO, WORLD!"
Example The title() Converts the first
character of each word to upper case:
a = "hello, world!"
print([Link]())# returns "Hello, World!
Example The count() Returns the number of
times a specified value occurs in a string:
a = "hello, world!"
print([Link]("l")) # returns 3
Example The find() Searches the string for a
specified value and returns the position of
where it was found:
a = "Hello, World!"
print([Link]("l")) # returns 2
print([Link]("l",4)) # returns 10
Example The replace() method replaces a
string with another string:
a = "Hello, World!"
print([Link]("H", "J"))#returns "Jello, World!"
Example The split() method splits the string
into substrings if it finds instances of the
separator:
a = "Hello, World!"
print([Link](",")) # returns ['Hello', ' World!']
Python
Operators
Operators
Operators are used to perform
operations on variables and
values.
Arithmetic operators
Assignment operators
Comparison operators
Operators Logical operators
Identity operators
Membership operators
Bitwise operators
Arithmetic Operators
Arithmetic operators are used with numeric values to
perform common mathematical operations
Arithmetic Operators
Assignment Operators
Assignment operators are used to assign values
to variables
Assignment Operators
Comparison Operators
Comparison operators are used to compare two
values
Comparison Operators
Python
Operators
Arithmetic operators
Assignment operators
Comparison operators
Operators Logical operators
Identity operators
Membership operators
Bitwise operators
Logical Operators
Logical operators are used to combine conditional
statements
Logical Operators
Identity Operators
Identity operators are used to compare the
objects, not if they are equal, but if they are
actually the same object, with the same memory
location
Identity Operators
Membership Operators
Membership operators are used to test if a sequence
is presented in an object
Membership Operators
Python
Operators
Arithmetic operators
Assignment operators
Comparison operators
Operators Logical operators
Identity operators
Membership operators
Bitwise operators
Bitwise Operators
Bitwise operators are used to compare (binary)
numbers
Bitwise Operators
PYTHON LIST
Python by Computer G
LIST A list is a collection which is
ordered and changeable. In Python
lists are written with square
brackets.
Example Create a List:
thislist = ["apple", "banana", "cherry"]
print(thislist) # returns ['apple', 'banana', 'cherry']
ACCESS ITEMS
You access the list items by referring to the index number:
Example Print the second item of the list:
thislist = ["apple", "banana", "cherry"]
print(thislist[1]) # returns banana
CHANGE ITEM VALUE
To change the value of a specific item, refer to the index number:
Example Change the second item:
thislist = ["apple", "banana", "cherry"]
thislist[1] = "grapes" print(thislist)
# returns ['apple', 'grapes', 'cherry']
CHECK IF ITEM EXISTS
To determine if a specified item is present in a list use the in
keyword:
Example Check if "apple" is present in the list:
thislist = ["apple", "banana", "cherry"]
if "apple" in thislist:
print("Yes, 'apple' is in the fruits list")
LIST LENGTH
To determine how many items a list has, use the len()
method: Example Print the number of items in the list:
thislist = ["apple", "banana", "cherry"]
print(len(thislist)) # returns 3
REMOVE ITEM
There are several methods to remove items from a list:
Example The remove() method removes the specified item:
thislist = ["apple", "banana", "cherry"]
[Link]("banana")
print(thislist) # returns ['apple', 'cherry']
POP() METHOD
Example The pop() method removes the specified index,
(or the last item if index is not specified):
thislist = ["apple", "banana", "cherry"]
[Link]()
print(thislist)
# returns ['apple', 'banana']
DEL
Example The del keyword removes the specified index:
thislist = ["apple", "banana", "cherry"]
del thislist[0]
print(thislist) # returns ['banana', 'cherry']
Example The del keyword can also delete the list
completely:
thislist = ["apple", "banana", "cherry"]
del thislist
CLEAR()
Example The clear() method empties the list:
thislist = ["apple", "banana", "cherry"]
[Link]()
print(thislist) # returns [ ]
COPY A LIST
You cannot copy a list simply by typing list2 = list1,
because: list2 will only be a reference to list1, and
changes made in list1 will automatically also be
made in list2.
There are ways to make a copy, one way is to use
the built-in List method copy()
COPY()
Example Make a copy of a list with the copy() method:
thislist = ["apple", "banana", "cherry"]
mylist = [Link]()
print(mylist)
# returns ['apple', 'banana', 'cherry']
COPY A LIST
Example Make a copy of a list with the list() method:
thislist = ["apple", "banana", "cherry"]
mylist = list(thislist)
print(mylist) # returns ['apple', 'banana', 'cherry']
PYTHON TUPLE
Python by Computer G
TUPLE A tuple is a collection which is
ordered and unchangeable. In
Python tuples are written with round
brackets.
Example Create a Tuple:
thistuple = ("apple", "banana", "cherry")
print(thistuple) # returns ('apple', 'banana', 'cherry')
ACCESS TUPLE ITEMS
You can access tuple items by referring to the index number,
inside square brackets:
Example Return the item in position 1:
thistuple = ("apple", "banana", "cherry")
print(thistuple[1]) # returns banana
CHANGE TUPLE VALUES
Once a tuple is created, you cannot change its
values. Tuples are unchangeable.
CHECK IF ITEM EXISTS
To determine if a specified item is present in a tuple use the
in keyword:
Example Check if "apple" is present in the tuple:
thistuple = ("apple", "banana", "cherry")
if "apple" in thistuple:
print("Yes, 'apple' is in the fruits tuple")
TUPLE LENGTH
To determine how many items a tuple has, use the len()
method:
Example Print the number of items in the tuple:
thistuple = ("apple", "banana", "cherry")
print(len(thistuple)) # returns 3
ADD ITEMS
Once a tuple is created, you cannot add items to it. Tuples
are unchangeable.
Example You cannot add items to a tuple:
thistuple = ("apple", "banana", "cherry")
thistuple[3] = "orange" # This will raise an error
print(thistuple)
REMOVE ITEMS
Note: You cannot remove items in a tuple.
Tuples are unchangeable, so you cannot remove items
from it, but you can delete the tuple completely:
Example The del keyword can delete the tuple
completely:
thistuple = ("apple", "banana", "cherry")
del thistuple
PYTHON SETS
Python by Computer G
SETS A set is a collection which is
unordered and unindexed. In Python
sets are written with curly brackets.
Example Create a Set:
thisset = {"apple", "banana", "cherry"}
print(thisset) # returns {'cherry', 'banana', 'apple'}
Note: Sets are unordered, so you cannot be sure in which order
the items will appear.
ACCESS ITEMS
You cannot access items in a set by referring to an
index, since sets are unordered the items has no
index.
CHECK IF ITEM EXISTS
To determine if a specified item is present in a set use the in
keyword:
Example Check if "banana" is present in the set:
thisset = {"apple", "banana", "cherry"}
print("banana" in thisset)
CHANGE ITEMS
Once a set is created, you cannot change its items,
but you can add new items.
ADD ITEMS
To add one item to a set use the add() method.
To add more than one item to a set use the update()
method. Example Add an item to a set, using the add()
method: thisset = {"apple", "banana", "cherry"}
[Link]("orange")
print(thisset) # returns {'apple', 'cherry', 'orange', 'banana'}
ADD ITEMS
Example Add multiple items to a set, using the update()
method:
thisset = {"apple", "banana", "cherry"}
[Link](["orange", "mango", "grapes"])
print(thisset) # returns {'apple', 'grapes', 'orange', 'banana',
'mango', 'cherry'}
GET THE LENGTH OF A SET
To determine how many items a set has, use the len()
method.
Example Get the number of items in a set:
thisset = {"apple", "banana", "cherry"}
print(len(thisset)) # returns 3
REMOVE ITEM
To remove an item in a set, use the remove(), or the
discard() method.
Example Remove "banana" by using the remove()
method:
thisset = {"apple", "banana", "cherry"}
[Link]("banana")
print(thisset) # returns {'cherry', 'apple'}
REMOVE ITEM
Example Remove "banana" by using the discard()
method:
thisset = {"apple", "banana", "cherry"}
[Link]("banana")
print(thisset) # returns {'cherry', 'apple'}
REMOVE ITEM
You can also use the pop(), method to remove an item,
but this method will remove the last item. Remember
that sets are unordered, so you will not know what item
that gets removed.
The return value of the pop() method is the removed
item.
REMOVE ITEM
Example Remove the last item by using the pop() method:
thisset = {"apple", "banana", "cherry"}
x = [Link]()
print(x) # returns apple
print(thisset) # returns {'cherry', 'banana'}
Note: Sets are unordered, so when using the pop() method,
you will not know which item that gets removed.
REMOVE ITEM
Example The clear() method empties the set:
thisset = {"apple", "banana", "cherry"}
[Link]()
print(thisset) # returns set()
Example The del keyword will delete the set completely:
thisset = {"apple", "banana", "cherry"}
del thisset
PYTHON
DICTIONARIES
Python by Computer G
DICTIONARIES
A dictionary is a collection which is unordered, changeable and
indexed. In Python dictionaries are written with curly brackets,
and they have keys and values.
Example Create and print a dictionary:
thisdict = { "brand": "Ford",
"model": "Mustang",
"year": 1964 }
print(thisdict) # returns {'brand': 'Ford', 'model': 'Mustang', 'year':
1964}
ACCESSING ITEMS
You can access the items of a dictionary by referring to its
key name, inside square brackets:
Example Get the value of the "model" key:
x = thisdict["model"]
There is also a method called get() that will give you the
same result:
Example Get the value of the "model" key:
x = [Link]("model")
CHANGE VALUES
You can change the value of a specific item by referring to
its key name:
Example Change the "year" to 2018:
thisdict = { "brand": "Ford",
"model": "Mustang",
"year": 1964 }
thisdict["year"]=2019 # returns {'brand': 'Ford', 'model':
'Mustang', 'year': 2019}
CHECK IF KEY EXISTS
To determine if a specified key is present in a dictionary use the
in keyword:
Example Check if "model" is present in the dictionary:
thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964 }
if "model" in thisdict:
print("Yes, 'model' is one of the keys in the thisdict dictionary")
DICTIONARY LENGTH
To determine how many items (key-value pairs) a dictionary
has, use the len() method.
Example Print the number of items in the dictionary:
print(len(thisdict))
ADDING ITEMS
Adding an item to the dictionary is done by using a new
index key and assigning a value to it:
Example
thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964 }
thisdict["color"] = "red"
print(thisdict)
REMOVING ITEMS
There are several methods to remove items from a dictionary:
The pop() method removes the item with the specified key
name:
thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964 }
[Link]("model")
print(thisdict)
REMOVE ITEM
Example The popitem() method removes the last
inserted item
thisdict = { "brand": "Ford",
"model": "Mustang",
"year": 1964 }
[Link]()
print(thisdict)
DEL KEYWORD
Example The del keyword removes the item with the
specified key name:
thisdict = { "brand": "Ford", "model": "Mustang", "year":
1964 }
del thisdict["model"]
print(thisdict)
DEL KEYWORD
Example The del keyword can also delete the dictionary
completely:
thisdict = { "brand": "Ford", "model": "Mustang", "year":
1964 }
del thisdict
CLEAR()
Example The clear() keyword empties the dictionary:
thisdict = { "brand": "Ford", "model": "Mustang", "year":
1964 }
[Link]()
print(thisdict)
COPY A DICTIONARY
You cannot copy a dictionary simply by typing dict2
= dict1, because: dict2 will only be a reference to
dict1, and changes made in dict1 will automatically
also be made in dict2.
COPY A DICTIONARY
There are ways to make a copy, one way is to use the built-
in Dictionary method copy().
Example Make a copy of a dictionary with the copy()
method:
thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964 }
mydict = [Link]()
print(mydict)
COPY A DICTIONARY
Another way to make a copy is to use the built-in method
dict().
Example Make a copy of a dictionary with the dict()
method:
thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964 }
mydict = dict(thisdict)
print(mydict)
PYTHON
CONDITIONS
Python by Computer G
PYTHON CONDITIONS
if statement
elif
else
PYTHON CONDITIONS
Python supports the usual logical conditions from mathematics:
Equals: a == b 
Not Equals: a != b 
Less than: a < b 
Less than or equal to: a <= b 
Greater than: a > b 
Greater than or equal to: a >= b
IF STATEMENT
An "if statement" is written by using the if keyword.
Example If statement:
a = 33
b = 200
if b > a:
print("b is greater than a")
INDENTATION
Python relies on indentation, using whitespace, to define
scope in the code. Other programming languages often use
curly-brackets for this purpose.
Example If statement, without indentation (will raise an
error):
a = 33
b = 200
if b > a:
print("b is greater than a") # you will get an error
ELIF
The elif keyword is pythons way of saying "if the previous
conditions were not true, then try this condition".
Example
a = 33
b = 33
if b > a:
print("b is greater than a")
elif a == b:
print("a and b are equal")
ELSE
The else keyword catches anything which isn't caught by the preceding
conditions.
Example
a = 200
b = 33
if b > a:
print("b is greater than a")
elif a == b:
print("a and b are equal")
else:
print("a is greater than b")
You can also have an else without the elif:
Example
a = 200
b = 33
if b > a:
print("b is greater than a")
else:
print("b is not greater than a")
PYTHON
CONDITIONS
Python by Computer G
SHORT HAND IF ... ELSE
If you have only one statement to execute, one for if, and
one for else, you can put it all on the same line:
Example One line if else statement:
print("A") if a > b else print("B")
PYTHON CONDITIONS
You can also have multiple else statements on the same
line:
Example One line if else statement, with 3 conditions:
print("A") if a > b else print("=") if a == b else print("B")
AND
The and keyword is a logical operator, and is used to
combine conditional statements:
Example Test if a is greater than b, AND if c is greater
than a:
if a > b and c > a: print("Both conditions are True")
OR
The or keyword is a logical operator, and is used to combine
conditional statements:
Example Test if a is greater than b, OR if a is greater than c:
if a > b or a > c:
print("At least one of the conditions is True")
THE WHILE LOOP
With the while loop we can execute a set of statements as long
as a condition is true.
Example Print i as long as i is less than 10:
i=1
while i < 10:
print(i)
i += 1.
Note: Remember to increment i, or else
the loop will continue forever
BREAK STATEMENT
With the break statement we can stop the loop even if the while
condition is true:
Example Exit the loop when i is 5:
i=1
while i < 10:
print(i)
if i == 5:
break
i += 1
CONTINUE STATEMENT
With the continue statement we can stop the current iteration,
and continue with the next:
Example Continue to the next iteration if i is 3:
i=0
while i < 10:
i += 1
if i == 3:
continue
print(i)
FOR LOOPS

Python by Computer G
THE FOR LOOP
A for loop is used for iterating over a sequence (that is either a
list, a tuple, a dictionary, a set, or a string).
Example Print each fruit in a fruit list:
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)

Note: Remember to increment i, or else


the loop will continue forever
BREAK STATEMENT
With the break statement we can stop the loop before it has looped
through all the items:
Example Exit the loop when x is "banana":
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)
if x == "banana":
break
CONTINUE STATEMENT
With the continue statement we can stop the current iteration of
the loop, and continue with the next:
Example Do not print banana:
fruits = ["apple", "banana", "cherry"]
for x in fruits:
if x == "banana":
continue print(x)
THE RANGE() FUNCTION
To loop through a set of code a specified number of times, we can
use the range() function
Example Increment the sequence with 3 (default is 1):
for x in range(2, 30, 3):
print(x)
NESTED LOOPS

Python by Computer G
NESTED LOOPS
A nested loop is a loop inside a loop.
The "inner loop" will be executed one time for each
iteration of the "outer loop":
Example Print each adjective for every fruit:
adj = ["red", "big", "tasty"]
fruits = ["apple", "banana", "cherry"]
for x in adj:
for y in fruits:
print(x, y)
FUNCTIONS

Python by Computer G
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.
Creating a Function:
In Python a function is defined using the def keyword:
Example
def my_function():
print("Hello from a function")
CALLING A FUNCTION
To call a function, use the function name followed by
parenthesis:
Example
def my_function():
print("Hello from a function")

my_function()
PARAMETERS
Information can be passed to functions as parameter.
Parameters are specified after the function name,
inside the parentheses. You can add as many
parameters as you want, just separate them with a
comma.
PARAMETERS
Example
def my_function(fname):
print(fname + " Refsnes")

my_function("Emil")
my_function("Tobias")
my_function("Linus")
PASSING A LIST AS A PARAMETER
You can send any data types of parameter to a
function (string, number, list, dictionary etc.), and it
will be treated as the same data type inside the
function.
PASSING A LIST AS A PARAMETER
Example
def my_function(food):
for x in food:
print(x)
fruits = ["apple", "banana", "cherry"]
my_function(fruits)
RETURN VALUES
To let a function return a value, use the return statement:
Example
def my_function(x):
return 5 * x
print(my_function(3))
print(my_function(5))
print(my_function(9))
RECURSION
RECURSION
Python also accepts function recursion, which means a
defined function can call itself.
Recursion is a common mathematical and
programming concept. It means that a function calls
itself. This has the benefit of meaning that you can
loop through data to reach a result.
def fact(n):
if n == 1:
return n
else:
return n*fact(n-1)
num = 7
if num < 0:
print("Sorry, factorial does not exist for negative numbers")
elif num == 0:
print("The factorial of 0 is 1")
else:
print("The factorial of", num, "is", fact(num))
PYTHON SCOPE
A variable is only available from inside the region it is created. This
is called scope.
Local Scope
A variable created inside a function belongs to the local scope of
that function, and can only be used inside that function.
Example
def myfunc():
x = 100
print(x)
myfunc()
Function Inside Function
As explained in the example above, the variable x is not available outside the
function, but it is available for any function inside the function:
Example The local variable can be accessed from a function within the
function:
def myfunc():
x = 300
def myinnerfunc():
print(x)
myinnerfunc()

myfunc()
Global Scope
A variable created in the main body of the Python code is a global
variable and belongs to the global scope. Global variables are available
from within any scope, global and local.
Example A variable created outside of a function is global and can be
used by anyone:
x = 300
def myfunc():
print(x)
myfunc()
print(x)
Global Keyword
If you need to create a global variable, but are stuck in the local scope,
you can use the global keyword. The global keyword makes the variable
global. Example If you use the global keyword, the variable belongs to
the global scope:
def myfunc():
global x
x = 300
myfunc()
print(x)
ERROR HANDLING
Python Try Except
The try block lets you test a block of code for errors.
The except block lets you handle the error.
The else block lets you execute code when there is no
error.
The finally block lets you execute code, regardless of
the result of the try- and except blocks.
Exception Handling
When an error occurs, or exception as we call it, Python will normally stop and
generate an error message.
These exceptions can be handled using the try statement:
Example The try block will generate an exception, because x is not defined:
try:
print(x)
except:
print("An exception occurred")
Since the try block raises an error, the except block will be executed. Without
the try block, the program will crash and raise an error: Example This
statement will raise an error, because x is not defined: print(x)
Many Exceptions
You can define as many exception blocks as you want, e.g. if you want to
execute a special block of code for a special kind of error:
Example Print one message if the try block raises a NameError and
another for other errors:
try:
print(x)
except NameError:
print("Variable x is not defined")
except:
print("Something else went wrong")
Else
You can use the else keyword to define a block of code to be executed if
no errors were raised:
Example In this example, the try block does not generate any error:
try:
print("Hello")
except:
print("Something went wrong")
else:
print("Nothing went wrong")
Finally
The finally block, if specified, will be executed regardless if the try block
raises an error or not.
Example
try:
print(x)
except:
print("Something went wrong")
finally:
print("The 'try except' is finished")
Raise an exception
As a Python developer you can choose to throw an exception if a
condition occurs.
To throw (or raise) an exception, use the raise keyword.
Example Raise an error and stop the program if x is lower than 0:
x = -1
if x < 0:
raise Exception("Sorry, no numbers below zero")
The raise keyword is used to raise an exception.
Python
M3-R5

NumPy
What is NumPy?
NumPy is a Python library used for working with arrays.
It also has functions for working in domain of linear
algebra, fourier transform, and matrices.
NumPy was created in 2005 by Travis Oliphant. It is an
open source project and you can use it freely.
NumPy stands for Numerical Python.
Why Use NumPy?
In Python we have lists that serve the purpose of arrays,
but they are slow to process.
NumPy aims to provide an array object that is up to 50x
faster than traditional Python lists.
The array object in NumPy is called ndarray, it provides a
lot of supporting functions that make working with ndarray
very easy. Arrays are very frequently used in data science,
where speed and resources are very important.
Why is NumPy Faster than Lists?
NumPy arrays are stored at one continuous place in
memory unlike lists, so processes can access and
manipulate them very efficiently. This behavior is called
locality of reference in computer science. This is the main
reason why NumPy is faster than lists. Also it is optimized
to work with latest CPU architectures.
Which Language is NumPy written in?
NumPy is a Python library and is written partially in Python, but most
of the parts that require fast computation are written in C or C++

Installation of NumPy
If you have Python and PIP already installed on a system, then
installation of NumPy is very easy.
Install it using this command:
C:\Users\Your Name>pip install numpy
If this command fails, then use a python distribution that already has
NumPy installed like, Anaconda, Spyder etc.
Import NumPy
Once NumPy is installed, import it in your applications by adding the
import keyword:
import numpy
Now NumPy is imported and ready to use.
Example
import numpy
arr = [Link]([1, 2, 3, 4, 5])
print(arr)
NumPy as np
NumPy is usually imported under the np alias.
alias: In Python alias are an alternate name for referring to the same
thing.
Create an alias with the as keyword while importing:
import numpy as np
Now the NumPy
package can be referred to as np instead of numpy.
Example
import numpy as np
arr = [Link]([1, 2, 3, 4, 5])
print(arr)
Checking NumPy Version
The version string is stored under __version__
attribute.
Example
import numpy as np
print(np.__version__)
हमारा कोर्स और PDF पूरी तरह से निःशुल्क हैं। इस Course को तैयार करने में काफी
ज्यादा मेहनत लगती है | इसलिए यदि आप कु छ शुल्क 50, 100, 200 रुपए जो
आपको उचित लगता है Pay कर सकते हैं अगर आप सक्षम है तो, धन्यवाद !!!

Bank details
Account no:-19000110048269
IFSC:-UCBA0001900
HIMANSHU TIWARI
NumPy Creating Arrays
Create a NumPy ndarray Object
NumPy is used to work with arrays. The array object in NumPy is
called ndarray. We can create a NumPy ndarray object by using
the array() function.
Example
import numpy as np
arr = [Link]([1, 2, 3, 4, 5])
print(arr)
print(type(arr))
type(): This built-in Python function tells us the type of the object
passed to it. Like in above code it shows that arr is [Link]
type.
To create an ndarray, we can pass a list, tuple or any array-like
object into the array() method, and it will be converted into an
ndarray:
Example Use a tuple to create a NumPy array:
import numpy as np
arr = [Link]((1, 2, 3, 4, 5))
print(arr)
Dimensions in Arrays
A dimension in arrays is one level of array depth (nested arrays).
Nested array: are arrays that have arrays as their elements.
0-D Arrays
0-D arrays, or Scalars, are the elements in an array. Each value in
an array is a 0- D array.
Example Create a 0-D array with value 42
import numpy as np
arr = [Link](42)
print(arr)
1-D Arrays
An array that has 0-D arrays as its elements is called uni-
dimensional or 1-D array. These are the most common and
basic arrays.
Example Create a 1-D array containing the values 1,2,3,4,5:

import numpy as np
arr = [Link]([1, 2, 3, 4, 5])
print(arr)
2-D Arrays
An array that has 1-D arrays as its elements is called a 2-D
array. These are often used to represent matrix or 2nd
order tensors. NumPy has a whole sub module dedicated
towards matrix operations called [Link]
Example Create a 2-D array containing two arrays with the
values 1,2,3 and 4,5,6.
import numpy as np
arr = [Link]([[1, 2, 3], [4, 5, 6]])
print(arr)
3-D arrays
An array that has 2-D arrays (matrices) as its elements is
called 3-D array. These are often used to represent a 3rd
order tensor.
Example Create a 3-D array with two 2-D arrays, both
containing two arrays with the values 1,2,3 and 4,5,6:
import numpy as np
arr = [Link]([[[1, 2, 3], [4, 5, 6]], [[1, 2, 3], [4, 5, 6]]])
print(arr)
Check Number of Dimensions?
NumPy Arrays provides the ndim attribute that returns an integer
that tells us how many dimensions the array have.
Example Check how many dimensions the arrays have:
import numpy as np
a = [Link](42)
b = [Link]([1, 2, 3, 4, 5])
c = [Link]([[1, 2, 3], [4, 5, 6]])
d = [Link]([[[1, 2, 3], [4, 5, 6]], [[1, 2, 3], [4, 5, 6]]])
print([Link])
print([Link])
print([Link])
print([Link])
NumPy Array Indexing Access Array Elements
Array indexing is the same as accessing an array element.
You can access an array element by referring to its index
number.
The indexes in NumPy arrays start with 0, meaning that the
first element has index 0, and the second has index 1 etc.
Example Get the first element from the following array:
import numpy as np
arr = [Link]([1, 2, 3, 4])
print(arr[0])
Example Get the second element from the following array.
import numpy as np
arr = [Link]([1, 2, 3, 4])
print(arr[1])
Example Get third and fourth elements from the following
array and add them.
import numpy as np
arr = [Link]([1, 2, 3, 4])
print(arr[2] + arr[3])
Access 2-D
Arrays To access elements from 2-D arrays we can use comma
separated integers representing the dimension and the index
of the element.
Think of 2-D arrays like a table with rows and columns, where
the row represents the dimension and the index represents
the column.
Example Access the element on the first row, second column:
import numpy as np
arr = [Link]([[1,2,3,4,5], [6,7,8,9,10]])
print('2nd element on 1st row: ', arr[0, 1])
Example Access the element on the 2nd row, 5th column:
import numpy as np
arr = [Link]([[1,2,3,4,5], [6,7,8,9,10]])
print('5th element on 2nd row: ', arr[1, 4])
Access 3-D Arrays
To access elements from 3-D arrays we can use comma
separated integers representing the dimensions and the index
of the element.
Example Access the third element of the second array of the
first array:
import numpy as np
arr = [Link]([[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]])
print(arr[0, 1, 2])
हमारा कोर्स और PDF पूरी तरह से निःशुल्क हैं। इस Course को तैयार करने में काफी
ज्यादा मेहनत लगती है | इसलिए यदि आप कु छ शुल्क 50, 100, 200 रुपए जो
आपको उचित लगता है Pay कर सकते हैं अगर आप सक्षम है तो, धन्यवाद !!!

Bank details
Account no:-19000110048269
IFSC:-UCBA0001900
HIMANSHU TIWARI
Slicing arrays
Slicing in python means taking elements from one given index to
another given index.
We pass slice instead of index like this: [start:end].
We can also define the step, like this: [start:end:step].
If we don't pass start its considered 0 If we don't pass end its
considered length of array in that dimension If we don't pass step
its considered 1
Example Slice elements from index 1 to index 5 from the
following array:
import numpy as np
arr = [Link]([1, 2, 3, 4, 5, 6, 7])
print(arr[1:5])
Example Slice elements from index 4 to the end of the array:
import numpy as np
arr = [Link]([1, 2, 3, 4, 5, 6, 7])
print(arr[4:])
Example Slice elements from the beginning to index 4 (not
included):
import numpy as np
arr = [Link]([1, 2, 3, 4, 5, 6, 7])
print(arr[:4])
Negative Slicing
Use the minus operator to refer to an index from the end:
Example Slice from the index 3 from the end to index 1 from the
end:
import numpy as np
arr = [Link]([1, 2, 3, 4, 5, 6, 7])
print(arr[-3:-1])
STEP
Use the step value to determine the step of the slicing:
Example Return every other element from index 1 to index 5:
import numpy as np
arr = [Link]([1, 2, 3, 4, 5, 6, 7])
print(arr[Link])
Example Return every other element from the entire array:
import numpy as np
arr = [Link]([1, 2, 3, 4, 5, 6, 7])
print(arr[::2])
Slicing 2-D Arrays
Example From the second element, slice elements from
index 1 to index 4 (not included):
import numpy as np
arr = [Link]([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
print(arr[1, 1:4])
Note: Remember that second element has index 1.
Example From both elements, return index 2:
import numpy as np
arr = [Link]([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
print(arr[0:2, 2])
Example From both elements, slice index 1 to index 4 (not
included), this will return a 2-D array:
import numpy as np
arr = [Link]([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
print(arr[0:2, 1:4])
हमारा कोर्स और PDF पूरी तरह से निःशुल्क हैं। इस Course को तैयार करने में काफी
ज्यादा मेहनत लगती है | इसलिए यदि आप कु छ शुल्क 50, 100, 200 रुपए जो
आपको उचित लगता है Pay कर सकते हैं अगर आप सक्षम है तो, धन्यवाद !!!

Bank details
Account no:-19000110048269
IFSC:-UCBA0001900
HIMANSHU TIWARI
Python
M3-R5
NumPy
NumPy Data Types
Data Types in Python
By default Python have these data types:
 strings - used to represent text data, the text is given under quote marks. e.g.
"ABCD"
 integer - used to represent integer numbers. e.g. -1, -2, -3
 float - used to represent real numbers. e.g. 1.2, 42.42
 boolean - used to represent True or False.
 complex - used to represent complex numbers. e.g. 1.0 + 2.0j, 1.5 + 2.5j
Data Types in NumPy
NumPy has some extra data types, and refer to data types
with one character, like i for integers, u for unsigned integers
etc. Below is a list of all data types in NumPy and the
characters used to represent them.
 i - integer
 b - boolean
 u - unsigned integer
 f - float
 c - complex float
 m - timedelta
 M - datetime
 O - object
 S - string
 U - unicode string
 V - fixed chunk of memory for other type ( void )
Checking the Data Type of an Array
The NumPy array object has a property called dtype that
returns the data type of the array:
Example Get the data type of an array object:
import numpy as np
arr = [Link]([1, 2, 3, 4])
print([Link])
Example Get the data type of an array containing strings:
import numpy as np
arr = [Link](['apple', 'banana', 'cherry'])
print([Link])
Creating Arrays with a Defined Data Type
We use the array() function to create arrays, this function can
take an optional argument: dtype that allows us to define the
expected data type of the array elements:
Example Create an array with data type string:
import numpy as np
arr = [Link]([1, 2, 3, 4], dtype='S')
print(arr)
print([Link])
For i, u, f, S and U we can define size as well.
Example Create an array with data type 4 bytes integer:
import numpy as np
arr = [Link]([1, 2, 3, 4], dtype='i4')
print(arr)
print([Link])
What if a Value Can Not Be Converted?
If a type is given in which elements can't be casted then
NumPy will raise a ValueError.
ValueError: In Python ValueError is raised when the type of
passed argument to a function is unexpected/incorrect.
Example A non-integer string like 'a' cannot be converted to
integer (will raise an error):
import numpy as np
arr = [Link](['a', '2', '3'], dtype='i')
Converting Data Type on Existing Arrays
The best way to change the data type of an existing array, is to
make a copy of the array with the astype() method.
The astype() function creates a copy of the array, and allows
you to specify the data type as a parameter.
The data type can be specified using a string, like 'f' for float,
'i' for integer etc. or you can use the data type directly like
float for float and int for integer. Example Change data type
from float to integer by using 'i' as parameter value:
import numpy as np
arr = [Link]([1.1, 2.1, 3.1])
newarr = [Link]('i')
print(newarr)
print([Link])
Example Change data type from float to integer by using int
as parameter value:
import numpy as np
arr = [Link]([1.1, 2.1, 3.1])
newarr = [Link](int)
print(newarr)
print([Link])
Example Change data type from integer to boolean:
import numpy as np
arr = [Link]([1, 0, 3])
newarr = [Link](bool)
print(newarr)
print([Link])
हमारा कोर्स और PDF पूरी तरह से निःशुल्क हैं। इस Course को तैयार करने में काफी
ज्यादा मेहनत लगती है | इसलिए यदि आप कु छ शुल्क 50, 100, 200 रुपए जो
आपको उचित लगता है Pay कर सकते हैं अगर आप सक्षम है तो, धन्यवाद !!!

Bank details
Account no:-19000110048269
IFSC:-UCBA0001900
HIMANSHU TIWARI
NumPy Array Copy vs View
The Difference between Copy and View
The main difference between a copy and a view of an array is
that the copy is a new array, and the view is just a view of the
original array.
The copy owns the data and any changes made to the copy will
not affect original array, and any changes made to the original
array will not affect the copy.
The view does not own the data and any changes made to the
view will affect the original array, and any changes made to the
original array will affect the view.
COPY:
Example Make a copy, change the original array, and display
both arrays:
import numpy as np
arr = [Link]([1, 2, 3, 4, 5])
x = [Link]()
arr[0] = 42
print(arr)
print(x)
The copy SHOULD NOT be affected by the changes made to
the original array.
VIEW:
Example Make a view, change the original array, and display
both arrays:
import numpy as np
arr = [Link]([1, 2, 3, 4, 5])
x = [Link]()
arr[0] = 42
print(arr)
print(x)
The view SHOULD be affected by the changes made to the
original array.
Make Changes in the VIEW:
Example Make a view, change the view, and display both arrays:
import numpy as np
arr = [Link]([1, 2, 3, 4, 5])
x = [Link]()
x[0] = 31
print(arr)
print(x)
The original array SHOULD be affected by the changes made to
the view.
NumPy Array Shape
Shape of an Array
The shape of an array is the number of elements in each
dimension.
Get the Shape of an Array
NumPy arrays have an attribute called shape that returns a
tuple with each index having the number of corresponding
elements.
Example Print the shape of a 2-D array:
import numpy as np
arr = [Link]([[1, 2, 3, 4], [5, 6, 7, 8]])
print([Link])
The example above returns (2, 4), which means that the array has 2
dimensions, where the first dimension has 2 elements and the
second has 4.
Example Create an array with 5 dimensions using ndmin using a
vector with values 1,2,3,4 and verify that last dimension has value 4:
import numpy as np
arr = [Link]([1, 2, 3, 4], ndmin=5)
print(arr)
print('shape of array :', [Link])
NumPy Array Reshaping
Reshaping arrays
Reshaping means changing the shape of an array.
The shape of an array is the number of elements in each dimension.
By reshaping we can add or remove dimensions or change number
of elements in each dimension.
Reshape From 1-D to 2-D
Example Convert the following 1-D array with 12 elements
into a 2-D array. The outermost dimension will have 4
arrays, each with 3 elements:
import numpy as np
arr = [Link]([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
newarr = [Link](4, 3)
print(newarr)
Reshape From 1-D to 3-D
Example Convert the following 1-D array with 12 elements
into a 3-D array. The outermost dimension will have 2
arrays that contains 3 arrays, each with 2 elements:
import numpy as np
arr = [Link]([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
newarr = [Link](2, 3, 2)
print(newarr)
Can We Reshape Into any Shape?
Yes, as long as the elements required for reshaping are equal
in both shapes. We can reshape an 8 elements 1D array into 4
elements in 2 rows 2D array but we cannot reshape it into a 3
elements 3 rows 2D array as that would require 3x3 = 9
elements.
Example Try converting 1D array with 8 elements to a 2D
array with 3 elements in each dimension (will raise an error):
import numpy as np
arr = [Link]([1, 2, 3, 4, 5, 6, 7, 8])
newarr = [Link](3, 3)
print(newarr)
हमारा कोर्स और PDF पूरी तरह से निःशुल्क हैं। इस Course को तैयार करने में काफी
ज्यादा मेहनत लगती है | इसलिए यदि आप कु छ शुल्क 50, 100, 200 रुपए जो
आपको उचित लगता है Pay कर सकते हैं अगर आप सक्षम है तो, धन्यवाद !!!

Bank details
Account no:-19000110048269
IFSC:-UCBA0001900
HIMANSHU TIWARI
Returns Copy or View?
Example Check if the returned array is a copy or a view: import
numpy as np
arr = [Link]([1, 2, 3, 4, 5, 6, 7, 8])
print([Link](2, 4).base)
The example above returns the original array, so it is a view.
Unknown Dimension
You are allowed to have one "unknown" dimension.
Meaning that you do not have to specify an exact number for one
of the dimensions in the reshape method.
Pass -1 as the value, and NumPy will calculate this number for
you.
Example Convert 1D array with 8 elements to 3D array with 2x2
elements:
import numpy as np
arr = [Link]([1, 2, 3, 4, 5, 6, 7, 8])
newarr = [Link](2, 2, -1)
print(newarr)
Note: We can not pass -1 to more than one dimension.
Flattening the arrays
Flattening array means converting a multidimensional array into a
1D array. We can use reshape(-1) to do this.
Example Convert the array into a 1D array:
import numpy as np
arr = [Link]([[1, 2, 3], [4, 5, 6]])
newarr = [Link](-1)
print(newarr)
Note: There are a lot of functions for changing the shapes of
arrays in numpy flatten, ravel and also for rearranging the
elements rot90, flip, fliplr, flipud etc. These fall under
Intermediate to Advanced section of numpy.

You might also like