0% found this document useful (0 votes)
42 views

Python CLASS

The document provides an overview of key concepts in programming languages and Python including: 1. Programming languages allow humans to communicate with machines through code and syntax rules. They are used to efficiently solve tasks with software. Commonly used languages include Python, Java. 2. Data is stored in variables in memory. Variables, data types, operators, control flow statements, functions, and object-oriented concepts are introduced. 3. Python is presented as a commonly used programming language. Key Python concepts covered include variables, data types, operators, conditional statements, loops, functions, object-oriented programming with classes, and data structures like lists, tuples, dictionaries and sets.

Uploaded by

mansirathee309
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Python CLASS

The document provides an overview of key concepts in programming languages and Python including: 1. Programming languages allow humans to communicate with machines through code and syntax rules. They are used to efficiently solve tasks with software. Commonly used languages include Python, Java. 2. Data is stored in variables in memory. Variables, data types, operators, control flow statements, functions, and object-oriented concepts are introduced. 3. Python is presented as a commonly used programming language. Key Python concepts covered include variables, data types, operators, conditional statements, loops, functions, object-oriented programming with classes, and data structures like lists, tuples, dictionaries and sets.

Uploaded by

mansirathee309
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

Importance and applications of PLs

What to we need to communicate with ppl?


Both people know the same lang.
(Language have set of grammar rules)

Communication with machines --


Programming language that have set of rules (called syntax) that help humans to
communicate with the machines.

Need of programming
To solve various tasks efficiently using softwares - programming codes

Application of programming languages(PLs)


Gaming
Banking
Machine learning

Commonly used PLs python java

basics 1 Page 1
Variables in programming
What is data?
In computers, Binary codes 0s and 1s
Every PL is converted into binary codes.

How to store data?


Data and value can be stored in temp. storages called
variables.
Example --

Basic lecture 3

Decision making statements


Make decisions on conditions or terms
Option1 or option2
This or else

basic2 and 3 Page 2


Looping statements
They are used to repeat a task multiple times.
Example- keep repeating a song until you close
the music app.

Basic lecture 5

Functions in
programming

What is a function?
Block of code that do specific tasks.
Example-
• deposit
• withdraw
• balance

Basic lecture 6

Object oriented
programming

Class is a template or blue print for real world


entities. Objects have properties and behavior.
Eg. Color, cost and make calls , play games.

basic 4 5 6 Page 3
Objects are specific instances of a class.
Example - phone (class)
Apple samsung nokia (specific instances of a class)

basic 4 5 6 Page 4
Algorithmic way to solve a problem

How to solve a problem?


By step by step approach

Example- how to make lemon juice?

Step by step approach to solve a problem is called algorithms .

Input-----algorithm------output

Algorithm to find if the number is odd or even

basic 7 8 Page 5
Basic lecture 8

Introduction to python
Free and open source(easy download and use accordingly)
Cross platform compatible (on any OS)
Large standard library(for various purposes python provides)
Object oriented

Downloaded
python
pycharm this an IDE integrated develoment environment
Anaconda for programming it’s a web base app.

basic 7 8 Page 6
Introduction to jupyter
notebook
It is a browser based interpreter that allows python
interaction.
steps to start working

They are .ipynb files

Kernel is executor of the programme


Help has some shortcuts

Basic lecture 10

Variables and data types in python


How do I store data?
In variable

Every variable is associated with a data type.

basic 9 10 Page 7
Int integers
Float decimals
Boolean true and false
String character in double quotes

basic 9 10 Page 8
Operators in python
Operations on data or variables using operators

Operators in python
• Relational <,>,==,!=
• Logical &, or, not
• Arithmetic +,-,/,*

basic 11 12 Page 9
Basic class 12
python tokens
Smallest meaningful component in a programm is token
• Keywords (special reserved words give info to compiler or interpreter)
• Identifiers (names used for variable function or obj.)
Rules
1. No special character except _
2. Case sensitive
3. First letter can't be a digit
• Literals(constants in python)
• Operators

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯


1. keywords

*We can't use keywords as variable class or function name as it causes error.*

basic 11 12 Page 10
Strings
They are sequence of characters in single double or triple quotes.

Extraction of indiv. character

String functions

basic 13 Page 11
basic 13 Page 12
basic 13 Page 13
Python tuples

DATA STRUCTURES IN PYTHON


These are variables
• Tuples {ordered collection of elements in() } have fixed value
• List
• Dictionary
• Set

tup1=(1,a,True)

Extracting indivisual items

basic 14 Page 14
basic 14 Page 15
basic 14 Page 16
basic 14 Page 17
Lists in python
List is an ordered collection of elements in[]
Their values can be changed.

basic15 Page 18
basic15 Page 19
basic15 Page 20
basic15 Page 21
Dictionary in python
it is an unordered collection of key value pairs enclosed in {}.
Values can be changed .

basic16 Page 22
basic16 Page 23
Set in python
Set is an unordered and unindexed collection of elements enclosed in {}
Duplicates arent allowed in a set.

s1={1,"a",True}

SET OPERATIONS

basic 17 Page 24
basic 17 Page 25
If statement

• If 3 conditions = elif statement

• If with list

basic18 Page 26
• If with Dictionary

basic18 Page 27
Looping statements in python

basic 19 Page 28
basic 19 Page 29
basic 19 Page 30
basic 19 Page 31
Problems in python

basic20 21 Page 32
BASIC LECTURE 21

FUNCTIONS IN PYTHON

basic20 21 Page 33
basic20 21 Page 34
basic20 21 Page 35
Intro - Object oriented programming

OOPS 1 Page 36
OOPS 1 Page 37
Creating class
• 1st word of class capital

oops2 Page 38
Adding parameters to a class method

oops3 Page 39
Creating class with constructor

oops4 Page 40
Inheritance in python

oops5 Page 41
oops5 Page 42
oops5 Page 43
Types of inheritance

oops6 Page 44
oops6 Page 45
oops6 Page 46
oops6 Page 47
Introduction to numpys

python ml 1 Page 48
python ml 1 Page 49
python ml 1 Page 50
Joining numpy arrays

Python machine learning lecture 3

Numpy intersection and difference

python machine learning lecture 4

Numpy intersection and difference

python ml 2 3 4 Page 51
python ml 2 3 4 Page 52
Numpy array mathematics

python ml 5 6 Page 53
python machine learning lecture 6

Sharing and loading numpy array

python ml 5 6 Page 54
Introduction to pandas

python machine learning lecture 8


pandas series object

python ml 7 8 Page 55
python ml 7 8 Page 56
python ml 7 8 Page 57
python ml 7 8 Page 58
python ml 7 8 Page 59
python ml 7 8 Page 60
Intro to panda dataframes

python ml 10 Page 61
python ml 10 Page 62
python ml 10 Page 63
Panda functions more

python ml 11 Page 64
Lesson 1

functions in python Page 65

You might also like