Installation
• Jupyter isa web server
• Anaconda Jupyter
• Cmd pip install notebook
• To open jupyter run “jupyter notebook”
• Python
3.
What is python?
•Python is a popular high-level programming language used
in various applications.
• Python is an easy language to learn because of its simple
syntax.
• Python works on different platforms (Windows, Mac, Linux).
• Python relies on indentation, using whitespace, to define
scope; such as the scope of loops, functions and classes.
4.
Data types
• Integer:Integers are whole numbers, positive or negative,
without any decimal point.
• Float: are numbers with a decimal point.
• String: Strings are sequences of characters, enclosed within
single quotes, double quotes.
• boolean: represents truth values, True or False.
5.
Data types cont.
•List is a collection which is changeable. Allows duplicate
members.
• Tuple is a collection which is ordered and unchangeable.
Allows duplicate members.
• Set is a collection which is unordered, unchangeable. No
duplicate members.
• Dictionary is a collection which is changeable. No duplicate
members.
• The input()function always returns a string, even if the user
enters a number or another type of value.
• For output we use print() function. This function is used to
display output to the console.
Input and output
9.
• example ofaccessing individual characters of a string using
indexing:
10.
• It canhave any number of items and they may be of
different types (integer, float, string etc.)
List
NumPy
• Pip installnumpy
• The NumPy library offers a collection of high-level
mathematical functions including support for
multi-dimensional arrays.
17.
NumPy arrays
• NumPyarrays are much faster than
Python lists for numerical operations.
• NumPy arrays use less memory and
are more compact.
• NumPy provides a broad range of
mathematical tools for arrays.
18.
NumPy arrays cont.
Built-inmethods to generate Arrays:
1. Array and shape
2. zeros and ones
3. Eye
4. Linspace
5. random number arrays
6. arange
7. max, min, argmax, argmin
8. reshape
19.
NumPy indexing
Indexing1Dand 2Darrays
1.Get a value at an index
2. Get values in a range
3. Setting a value with index range
4. Difference between copy and view in arrays
20.
NumPy selection
Indexing1Dand 2Darrays
1.Get a value at an index
2. Get values in a range
3. Setting a value with index range
4. Difference between copy and view in arrays
21.
NumPy operations
Arithmetic
1. Addition– subtraction – division – multiplication –
exponentiation
Universal Array Functions
1. Square roots
2. Exponential
3. Log
4. Sin and cos