SlideShare a Scribd company logo
Click to edit Master title style
1
Learn Coding | Python
( c o r e p y t h o n )
Click to edit Master title style
2
Topic we will cover in core python
2
• Introduction to python
• Installation of python and vscode
• Reserved words and Identifiers
• Data Types
• Type casting
• Operators
• Input and output statements
• Command line arguments
• control flow
• pass, del and None keyword
• functions
• Modules
Click to edit Master title style
3
Introduction to Python
C h a p t e r 0 1
3
Click to edit Master title style
4
What is python?
4
-general purpose high level language
-developed by Guido van Rossam in 1989
national research institute neatherland
-publically available : feb 20 1991
"monty flying python circus" broadcast by BBC in 1969-74.
Comedy show, it brings smile on the face.
Name taken from this show
Why the name python?
Click to edit Master title style
5
What Features taken from which languages ?
5
▪ functional progammng - c
▪ object oriented - c++
▪ modular programming - modula-3
▪ scripting - perl, bash scripting
Click to edit Master title style
6
Applications of python
6
-web development
-game development
-iot programming
-machine learning
-Artificial Intelligence
-Network programming
-db programming
Click to edit Master title style
7
Features of python
7
-Simple and easy to learn
-freeware and open source
-platform independent
-potable
-rich library
-extensible
-embedded
-dynamically types
-interpreted
Click to edit Master title style
8
Limitations of python
8
-mobile Application
-performence is not upto the mark
Click to edit Master title style
9
Flavors of python
9
• jython
• pypy
• anaconda python
• Cpython (default version)
Click to edit Master title style
10
Installation of Python
C h a p t e r 0 2
10
Click to edit Master title style
11
To install python :
11
• Visit the below site:
https://www.python.org/downloads/
• Click on download then install the python
To install vscode :
• Visit the below site:
https://code.visualstudio.com/download
• Choose your OS download will start automatically
Click to edit Master title style
12
Reserved Word & Identifiers
C h a p t e r 0 3
12
Click to edit Master title style
13
Reserved Words:
13
➢ words which convey special meaning to the Identifiers
➢ Only 33+ keyword in python
➢ Reserved words also known as keyword
➢ Only True, False, None starts with uppercase
➢ List of keywords are:-
'False', 'None', 'True', 'and', 'as', 'assert', 'async’,
'await', 'break', 'class', 'continue', 'def', 'del’,
'elif’, 'else', 'except', 'finally', 'for', 'from', global’,
'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not’,
'or', 'pass', 'raise', 'return', 'try', 'while’, 'with', 'yield'
Click to edit Master title style
14
Identifiers:
14
▪ A name in python program is called Identifier
▪ It can be class name, function name, variable name,
module name.
Click to edit Master title style
15
Rules to define Identifiers :
15
❑ Allowed character:
alphabet (uppercase or lowercase)
digits (0-9)
underscore (_)
❑ should not be start with digit
❑ we cant use Reserved word (keyword)
✓ Identifiers are case sensitive
Click to edit Master title style
16
Data Types
C h a p t e r 0 4
16
Click to edit Master title style
17
Data Types:
17
• data types represent the type of data present inside a
variable
• we do not need to specify the data type explicitly,
based on values types allocated automatically.
• Python is a dynamically typed language.
Click to edit Master title style
18
Primary Data Types:
18
1. int
2. float
3. complex
4. bool
5. string
Note: All primary data types are immutable in nature.
Click to edit Master title style
19
Inbuilt Data Types:
19
1. int
2. float
3. complex
4. bool
5. string
6. bytes
7. bytesarray
8. range
9. list
10. tupple
11. set
12. frozenset
13. dict
14. None
Click to edit Master title style
20
“SOME IMPORTANT FUNCTIONS
type():-
it returns the data type of the given
values
id():-
it return the id of the given values 20
Click to edit Master title style
21
int
21
- To represent the integeric values.
- We can store integeric value in various base.
decimal, binary, hexadecimal, octal
- Values with base 10 is default.
- Python can receive value in any base but store value in decial
form only
binary = '0B' '0b'
hex = '0x' '0X'
octal = '0o' '0O'
Click to edit Master title style
22
float
22
• to represent the floating point values
• we can also store numbers in exponential forms
- For e.g.
10e2 (means 10 to power 2 i.e 1000)
Click to edit Master title style
23
complex
23
• numbers of form a+bj is called complex number.
a => real part (integer/float) (hex, bin, dec, oct)
b => imaginary part (integer/float) (dec)
• To important attribute of complex object:
real ==> real part of numbers
imag ==> imaginary part
Click to edit Master title style
24
bool
24
• It represent Boolean values
• Supports only two values i.e. True, False
• Python internally store :
True as 1
False as 0
Click to edit Master title style
25
string
25
• String is sequence of characters.
• It is immutable in nature.
• The most used data type in any programming language.
• we can write single quote inside double quote
• double quote inside single quote
• triple quote for multi-line string
❑ Escape sequence characters has specific meaning inside string.
n -> new line
t -> horizontal tab
c -> carriage return
v -> vertical tab
 " v etc.
Click to edit Master title style
26
String Indexing
26
• Indexing is used to get the value at specific index.
• Forward indexing:
left to right - start with 0
right to left - start with -1
String Slicing
• Slicing is used slice the string (get the part of the string).
• [starting_position : ending_position : step]
Click to edit Master title style
27
Formating of String
27
• {} -> Replacement operator (it substitute the variable with the
value)
• f -> formatting string
• r -> raw string (treat the string as it is written)
Click to edit Master title style
28
Some Important Methods of String
28
• split("pattern") - split into several part based on pattern and
return a list.
• ("pattern").join(sequence) - join the string based on the pattern
• find("pattern","start", "end") - find the position of our pattern
in the string. if pattern not found then it will return -1
• index("pattern","start","end") - same as find but it will generate
error if pattern not found
• count("pattern", "start", "end") :- return no. of occurence of
specified pattern
Click to edit Master title style
29
Some Important Methods of String
29
• strip() - remove leading and trailing speaces
• replace("old patter", "new pattern") - replace older pattern
with new one.
Changing case of the string
upper() -> convert to uppercase
title()
lower()
capitalize()
Click to edit Master title style
30
Some Important Methods of String
30
• strip() - remove leading and trailing speaces
• replace("old patter", "new pattern") - replace older pattern
with new one.
Changing case of the string
upper() -> convert to uppercase
title()
lower()
capitalize()
Click to edit Master title style
31
Checking the case of the string
31
• isupper()
• islower()
• isalpha()
• isalnum()
• isspace()
Click to edit Master title style
32
range
32
• It is use to store the sequence of integeric numbers.
• range(begining, ending, step)
Click to edit Master title style
33
Type Casting
C h a p t e r 0 5
33
Click to edit Master title style
34
Type casting
34
• we can convert one type into another type . this conversion is
known as typecasting.
• int()
• float()
• complex()
• bool()
• str()
• list()
• tuple()
• set()
• dict()
Click to edit Master title style
35
Operator
C h a p t e r 0 6
35
Click to edit Master title style
36
Operator
36
operator are symbols that perform certain task
❑ Arithmetic Operators:
+, -, *, /, //, %, **
helps to perform arithmetic operations
❑ Relational or comparison operator:
<, <=, >, >=, ==, !=
helps to perform comparison between two object
❑ Logical operator:
and, or, not
helps to perform logical operations
Click to edit Master title style
37
37
❑ Bitwise operator (applicable for int and bool value only)
& -> bitwise and (if both 1 then 1 else 0)
| -> bitwise or (if any 1 then 1 else 0)
^ -> if both same then output 0 else 1
~ -> complement
>> -> right shift
<< -> left shift
helps to perform bitwise operations
❑ assignment operator
=
helps to assing value to a variable
Click to edit Master title style
38
38
❑ special operator:
a) identity operator
is, is not
helps to verify whether two object is same or not
b) membership operator
in, not in
helps to verify whether an object is the part of any sequence
Click to edit Master title style
39
Input & Output Statement
C h a p t e r 0 7
39
Click to edit Master title style
40
input()
40
It is used to take input from the user.
It always return string.
Syntax: variable_name = input(“your message here”)
print()
It is used print the output on the console
Syntax: print(“your message here”, sep=“”, end=“”)
where everything is optional
Click to edit Master title style
41
Flow Control
C h a p t e r 0 8
41
Click to edit Master title style
42
Flow Control
42
flow control describes the order in which statements will be
executed at runtime
❑ Conditional statements
• if - else
if the condition evaluate to true then if block will execute
otherwise else part.
❑ Iterative statements
• for
If you know in advance how many times block will execute then go
with the for loop
• while
Use it If you want to execute the block until condition remains true
Click to edit Master title style
43
43
❑ Transfer statements
• continue
it skip the iteration
break
it break the flow and get out of loop
pass
if we do not want to define define the body then we can
use pass
Note: we can use “else” also with the loop in python.
Else part will execute if the block within the loop completes its
execution without break.
Click to edit Master title style
44
len(), del(), None
C h a p t e r 0 9
44
Click to edit Master title style
45
del()
45
It is used to delete the object.
len()
It is similar to Null.
It means nothing
It returns the length of the object.
None
Click to edit Master title style
46
Inbuilt data types
C h a p t e r 1 0
46
Click to edit Master title style
47
List
47
-duplicates are Allowed
-heterogeneous object are Allowed
-slicing and indexing are Allowed
-mutable in nature
-order are maintained
-values are stored with in square brackets []
Tuple
- values stored within parenthesis ().
- parenthesis are optional
- it is exactly same as tuple but it is immutable.
Click to edit Master title style
48
set
48
-if we want to represent a group of unique value as a single
entity then we should go for set
-duplicates are not Allowed
-insertion order is not preserved
-indexing and slicing not work
-heterogeneous elements are Allowed
-mutable in nature
-values are stored within curly braces { }.
Click to edit Master title style
49
Dictionary
49
we can use list, tuple, and set to represent group object as A single
entity.
if we want to represent a group of object as key-value pairs then
we should go for Dictionary.
- do not support indexing and slicing
- insertion order is preserved
- heterogeneous
- mutable
- keys must be unique, but duplicates value are Allowed
- values are stored withing curly braces { key:value }
Click to edit Master title style
50
Command Line Arguments
C h a p t e r 11
50
Click to edit Master title style
51
Command Line Argument
51
With the help of command line argument we can pass the input at
the time of executing the program.
For this we have to import the sys module.
from sys import argv
Here argv is a list of values that are pases at the time of program
execution
Click to edit Master title style
52
Function
C h a p t e r 1 2
52
Click to edit Master title style
53
Function
53
If a group of statements is repeatedly required then it is not
recommended to write these statements every time separately.
We have to define these statements as a single unit and we can
call that unit any number of times based on our requirement
without rewriting. This unit is nothing but function.
The main advantage of functions is code Reusability
Click to edit Master title style
54
Types of Function
54
❑ Built-in Function :
The pre-defined function which comes with python.
e.g. len, type, print, del etc..
❑ User defined function:
we create to fulfil our business requirement.
Syntax:
def function_name(parameter):
“”” doc strintg “””
body
return value
Click to edit Master title style
55
Types of arguments
55
❑ Positional:
order should be maintained
no. of parameter = no. of arguments
❑ Keyword:
order is not important
no. of parameter = no. of arguments
keyword arguments should follow positional arguments
❑ Default arguments:
order is important
no. of parameter may or may not be equal no. of arguments
❑ Variable length arguments:
*args, **kwargs
Click to edit Master title style
56
Modules
C h a p t e r 1 3
56
Click to edit Master title style
57
Modules
57
A group of functions, variables and classes saved to a file, which is
nothing but module.
Every Python file (.py) acts as a module.
main objective : code Reusability
❑ Module aliasing:
---------------
to improve reality
to prevent name conflicting
Click to edit Master title style
58
#Bonus | Best Practices
C h a p t e r 1 4
58
Click to edit Master title style
59
Best Practices:
59
PEP8 ===> guidelines
snake case naming conversion
firstname X
first_name ----> snake
modules, functions, variable ===> should startwith lowercase
class ===> should startwith uppercase
Click to edit Master title style
60
60
_ => dummy variable for one time use.
for _ in range(10):
print(_)
constant variable should be in upper case.
meaningful of variables
Comment
doc string.....
Click to edit Master title style
61
Thank You
Like Share Subscribe | Learn Coding

More Related Content

Similar to Python

cmp104 lec 8
cmp104 lec 8cmp104 lec 8
cmp104 lec 8kapil078
 
2015 bioinformatics python_strings_wim_vancriekinge
2015 bioinformatics python_strings_wim_vancriekinge2015 bioinformatics python_strings_wim_vancriekinge
2015 bioinformatics python_strings_wim_vancriekinge
Prof. Wim Van Criekinge
 
C fundamentals
C fundamentalsC fundamentals
Cs1123 3 c++ overview
Cs1123 3 c++ overviewCs1123 3 c++ overview
Cs1123 3 c++ overviewTAlha MAlik
 
C language
C languageC language
C language
Robo India
 
0-Slot21-22-Strings.pdf
0-Slot21-22-Strings.pdf0-Slot21-22-Strings.pdf
0-Slot21-22-Strings.pdf
ssusere19c741
 
JCConf 2020 - New Java Features Released in 2020
JCConf 2020 - New Java Features Released in 2020JCConf 2020 - New Java Features Released in 2020
JCConf 2020 - New Java Features Released in 2020
Joseph Kuo
 
C programming language
C programming languageC programming language
C programming language
Mahmoud Eladawi
 
Console I/o & basics of array and strings.pptx
Console I/o & basics of array and strings.pptxConsole I/o & basics of array and strings.pptx
Console I/o & basics of array and strings.pptx
PRASENJITMORE2
 
programming week 2.ppt
programming week 2.pptprogramming week 2.ppt
programming week 2.ppt
FatimaZafar68
 
c
cc
What is Python.pdf
What is Python.pdfWhat is Python.pdf
What is Python.pdf
PDeepalakshmi1
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
marvellous2
 
python_class.pptx
python_class.pptxpython_class.pptx
python_class.pptx
chandankumar943868
 
C# 101: Intro to Programming with C#
C# 101: Intro to Programming with C#C# 101: Intro to Programming with C#
C# 101: Intro to Programming with C#
Hawkman Academy
 
web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Maloth
Bhavsingh Maloth
 
Python-Basics.pptx
Python-Basics.pptxPython-Basics.pptx
Python-Basics.pptx
TamalSengupta8
 
C# 7 development
C# 7 developmentC# 7 development
C# 7 development
Fisnik Doko
 

Similar to Python (20)

cmp104 lec 8
cmp104 lec 8cmp104 lec 8
cmp104 lec 8
 
2015 bioinformatics python_strings_wim_vancriekinge
2015 bioinformatics python_strings_wim_vancriekinge2015 bioinformatics python_strings_wim_vancriekinge
2015 bioinformatics python_strings_wim_vancriekinge
 
C fundamentals
C fundamentalsC fundamentals
C fundamentals
 
Cs1123 3 c++ overview
Cs1123 3 c++ overviewCs1123 3 c++ overview
Cs1123 3 c++ overview
 
C language
C languageC language
C language
 
0-Slot21-22-Strings.pdf
0-Slot21-22-Strings.pdf0-Slot21-22-Strings.pdf
0-Slot21-22-Strings.pdf
 
JCConf 2020 - New Java Features Released in 2020
JCConf 2020 - New Java Features Released in 2020JCConf 2020 - New Java Features Released in 2020
JCConf 2020 - New Java Features Released in 2020
 
C programming language
C programming languageC programming language
C programming language
 
Console I/o & basics of array and strings.pptx
Console I/o & basics of array and strings.pptxConsole I/o & basics of array and strings.pptx
Console I/o & basics of array and strings.pptx
 
programming week 2.ppt
programming week 2.pptprogramming week 2.ppt
programming week 2.ppt
 
c
cc
c
 
What is Python.pdf
What is Python.pdfWhat is Python.pdf
What is Python.pdf
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
python_class.pptx
python_class.pptxpython_class.pptx
python_class.pptx
 
C# 101: Intro to Programming with C#
C# 101: Intro to Programming with C#C# 101: Intro to Programming with C#
C# 101: Intro to Programming with C#
 
C_plus_plus
C_plus_plusC_plus_plus
C_plus_plus
 
web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Maloth
 
Python-Basics.pptx
Python-Basics.pptxPython-Basics.pptx
Python-Basics.pptx
 
C# 7 development
C# 7 developmentC# 7 development
C# 7 development
 
Assembler
AssemblerAssembler
Assembler
 

Recently uploaded

Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 

Recently uploaded (20)

Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 

Python

  • 1. Click to edit Master title style 1 Learn Coding | Python ( c o r e p y t h o n )
  • 2. Click to edit Master title style 2 Topic we will cover in core python 2 • Introduction to python • Installation of python and vscode • Reserved words and Identifiers • Data Types • Type casting • Operators • Input and output statements • Command line arguments • control flow • pass, del and None keyword • functions • Modules
  • 3. Click to edit Master title style 3 Introduction to Python C h a p t e r 0 1 3
  • 4. Click to edit Master title style 4 What is python? 4 -general purpose high level language -developed by Guido van Rossam in 1989 national research institute neatherland -publically available : feb 20 1991 "monty flying python circus" broadcast by BBC in 1969-74. Comedy show, it brings smile on the face. Name taken from this show Why the name python?
  • 5. Click to edit Master title style 5 What Features taken from which languages ? 5 ▪ functional progammng - c ▪ object oriented - c++ ▪ modular programming - modula-3 ▪ scripting - perl, bash scripting
  • 6. Click to edit Master title style 6 Applications of python 6 -web development -game development -iot programming -machine learning -Artificial Intelligence -Network programming -db programming
  • 7. Click to edit Master title style 7 Features of python 7 -Simple and easy to learn -freeware and open source -platform independent -potable -rich library -extensible -embedded -dynamically types -interpreted
  • 8. Click to edit Master title style 8 Limitations of python 8 -mobile Application -performence is not upto the mark
  • 9. Click to edit Master title style 9 Flavors of python 9 • jython • pypy • anaconda python • Cpython (default version)
  • 10. Click to edit Master title style 10 Installation of Python C h a p t e r 0 2 10
  • 11. Click to edit Master title style 11 To install python : 11 • Visit the below site: https://www.python.org/downloads/ • Click on download then install the python To install vscode : • Visit the below site: https://code.visualstudio.com/download • Choose your OS download will start automatically
  • 12. Click to edit Master title style 12 Reserved Word & Identifiers C h a p t e r 0 3 12
  • 13. Click to edit Master title style 13 Reserved Words: 13 ➢ words which convey special meaning to the Identifiers ➢ Only 33+ keyword in python ➢ Reserved words also known as keyword ➢ Only True, False, None starts with uppercase ➢ List of keywords are:- 'False', 'None', 'True', 'and', 'as', 'assert', 'async’, 'await', 'break', 'class', 'continue', 'def', 'del’, 'elif’, 'else', 'except', 'finally', 'for', 'from', global’, 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not’, 'or', 'pass', 'raise', 'return', 'try', 'while’, 'with', 'yield'
  • 14. Click to edit Master title style 14 Identifiers: 14 ▪ A name in python program is called Identifier ▪ It can be class name, function name, variable name, module name.
  • 15. Click to edit Master title style 15 Rules to define Identifiers : 15 ❑ Allowed character: alphabet (uppercase or lowercase) digits (0-9) underscore (_) ❑ should not be start with digit ❑ we cant use Reserved word (keyword) ✓ Identifiers are case sensitive
  • 16. Click to edit Master title style 16 Data Types C h a p t e r 0 4 16
  • 17. Click to edit Master title style 17 Data Types: 17 • data types represent the type of data present inside a variable • we do not need to specify the data type explicitly, based on values types allocated automatically. • Python is a dynamically typed language.
  • 18. Click to edit Master title style 18 Primary Data Types: 18 1. int 2. float 3. complex 4. bool 5. string Note: All primary data types are immutable in nature.
  • 19. Click to edit Master title style 19 Inbuilt Data Types: 19 1. int 2. float 3. complex 4. bool 5. string 6. bytes 7. bytesarray 8. range 9. list 10. tupple 11. set 12. frozenset 13. dict 14. None
  • 20. Click to edit Master title style 20 “SOME IMPORTANT FUNCTIONS type():- it returns the data type of the given values id():- it return the id of the given values 20
  • 21. Click to edit Master title style 21 int 21 - To represent the integeric values. - We can store integeric value in various base. decimal, binary, hexadecimal, octal - Values with base 10 is default. - Python can receive value in any base but store value in decial form only binary = '0B' '0b' hex = '0x' '0X' octal = '0o' '0O'
  • 22. Click to edit Master title style 22 float 22 • to represent the floating point values • we can also store numbers in exponential forms - For e.g. 10e2 (means 10 to power 2 i.e 1000)
  • 23. Click to edit Master title style 23 complex 23 • numbers of form a+bj is called complex number. a => real part (integer/float) (hex, bin, dec, oct) b => imaginary part (integer/float) (dec) • To important attribute of complex object: real ==> real part of numbers imag ==> imaginary part
  • 24. Click to edit Master title style 24 bool 24 • It represent Boolean values • Supports only two values i.e. True, False • Python internally store : True as 1 False as 0
  • 25. Click to edit Master title style 25 string 25 • String is sequence of characters. • It is immutable in nature. • The most used data type in any programming language. • we can write single quote inside double quote • double quote inside single quote • triple quote for multi-line string ❑ Escape sequence characters has specific meaning inside string. n -> new line t -> horizontal tab c -> carriage return v -> vertical tab " v etc.
  • 26. Click to edit Master title style 26 String Indexing 26 • Indexing is used to get the value at specific index. • Forward indexing: left to right - start with 0 right to left - start with -1 String Slicing • Slicing is used slice the string (get the part of the string). • [starting_position : ending_position : step]
  • 27. Click to edit Master title style 27 Formating of String 27 • {} -> Replacement operator (it substitute the variable with the value) • f -> formatting string • r -> raw string (treat the string as it is written)
  • 28. Click to edit Master title style 28 Some Important Methods of String 28 • split("pattern") - split into several part based on pattern and return a list. • ("pattern").join(sequence) - join the string based on the pattern • find("pattern","start", "end") - find the position of our pattern in the string. if pattern not found then it will return -1 • index("pattern","start","end") - same as find but it will generate error if pattern not found • count("pattern", "start", "end") :- return no. of occurence of specified pattern
  • 29. Click to edit Master title style 29 Some Important Methods of String 29 • strip() - remove leading and trailing speaces • replace("old patter", "new pattern") - replace older pattern with new one. Changing case of the string upper() -> convert to uppercase title() lower() capitalize()
  • 30. Click to edit Master title style 30 Some Important Methods of String 30 • strip() - remove leading and trailing speaces • replace("old patter", "new pattern") - replace older pattern with new one. Changing case of the string upper() -> convert to uppercase title() lower() capitalize()
  • 31. Click to edit Master title style 31 Checking the case of the string 31 • isupper() • islower() • isalpha() • isalnum() • isspace()
  • 32. Click to edit Master title style 32 range 32 • It is use to store the sequence of integeric numbers. • range(begining, ending, step)
  • 33. Click to edit Master title style 33 Type Casting C h a p t e r 0 5 33
  • 34. Click to edit Master title style 34 Type casting 34 • we can convert one type into another type . this conversion is known as typecasting. • int() • float() • complex() • bool() • str() • list() • tuple() • set() • dict()
  • 35. Click to edit Master title style 35 Operator C h a p t e r 0 6 35
  • 36. Click to edit Master title style 36 Operator 36 operator are symbols that perform certain task ❑ Arithmetic Operators: +, -, *, /, //, %, ** helps to perform arithmetic operations ❑ Relational or comparison operator: <, <=, >, >=, ==, != helps to perform comparison between two object ❑ Logical operator: and, or, not helps to perform logical operations
  • 37. Click to edit Master title style 37 37 ❑ Bitwise operator (applicable for int and bool value only) & -> bitwise and (if both 1 then 1 else 0) | -> bitwise or (if any 1 then 1 else 0) ^ -> if both same then output 0 else 1 ~ -> complement >> -> right shift << -> left shift helps to perform bitwise operations ❑ assignment operator = helps to assing value to a variable
  • 38. Click to edit Master title style 38 38 ❑ special operator: a) identity operator is, is not helps to verify whether two object is same or not b) membership operator in, not in helps to verify whether an object is the part of any sequence
  • 39. Click to edit Master title style 39 Input & Output Statement C h a p t e r 0 7 39
  • 40. Click to edit Master title style 40 input() 40 It is used to take input from the user. It always return string. Syntax: variable_name = input(“your message here”) print() It is used print the output on the console Syntax: print(“your message here”, sep=“”, end=“”) where everything is optional
  • 41. Click to edit Master title style 41 Flow Control C h a p t e r 0 8 41
  • 42. Click to edit Master title style 42 Flow Control 42 flow control describes the order in which statements will be executed at runtime ❑ Conditional statements • if - else if the condition evaluate to true then if block will execute otherwise else part. ❑ Iterative statements • for If you know in advance how many times block will execute then go with the for loop • while Use it If you want to execute the block until condition remains true
  • 43. Click to edit Master title style 43 43 ❑ Transfer statements • continue it skip the iteration break it break the flow and get out of loop pass if we do not want to define define the body then we can use pass Note: we can use “else” also with the loop in python. Else part will execute if the block within the loop completes its execution without break.
  • 44. Click to edit Master title style 44 len(), del(), None C h a p t e r 0 9 44
  • 45. Click to edit Master title style 45 del() 45 It is used to delete the object. len() It is similar to Null. It means nothing It returns the length of the object. None
  • 46. Click to edit Master title style 46 Inbuilt data types C h a p t e r 1 0 46
  • 47. Click to edit Master title style 47 List 47 -duplicates are Allowed -heterogeneous object are Allowed -slicing and indexing are Allowed -mutable in nature -order are maintained -values are stored with in square brackets [] Tuple - values stored within parenthesis (). - parenthesis are optional - it is exactly same as tuple but it is immutable.
  • 48. Click to edit Master title style 48 set 48 -if we want to represent a group of unique value as a single entity then we should go for set -duplicates are not Allowed -insertion order is not preserved -indexing and slicing not work -heterogeneous elements are Allowed -mutable in nature -values are stored within curly braces { }.
  • 49. Click to edit Master title style 49 Dictionary 49 we can use list, tuple, and set to represent group object as A single entity. if we want to represent a group of object as key-value pairs then we should go for Dictionary. - do not support indexing and slicing - insertion order is preserved - heterogeneous - mutable - keys must be unique, but duplicates value are Allowed - values are stored withing curly braces { key:value }
  • 50. Click to edit Master title style 50 Command Line Arguments C h a p t e r 11 50
  • 51. Click to edit Master title style 51 Command Line Argument 51 With the help of command line argument we can pass the input at the time of executing the program. For this we have to import the sys module. from sys import argv Here argv is a list of values that are pases at the time of program execution
  • 52. Click to edit Master title style 52 Function C h a p t e r 1 2 52
  • 53. Click to edit Master title style 53 Function 53 If a group of statements is repeatedly required then it is not recommended to write these statements every time separately. We have to define these statements as a single unit and we can call that unit any number of times based on our requirement without rewriting. This unit is nothing but function. The main advantage of functions is code Reusability
  • 54. Click to edit Master title style 54 Types of Function 54 ❑ Built-in Function : The pre-defined function which comes with python. e.g. len, type, print, del etc.. ❑ User defined function: we create to fulfil our business requirement. Syntax: def function_name(parameter): “”” doc strintg “”” body return value
  • 55. Click to edit Master title style 55 Types of arguments 55 ❑ Positional: order should be maintained no. of parameter = no. of arguments ❑ Keyword: order is not important no. of parameter = no. of arguments keyword arguments should follow positional arguments ❑ Default arguments: order is important no. of parameter may or may not be equal no. of arguments ❑ Variable length arguments: *args, **kwargs
  • 56. Click to edit Master title style 56 Modules C h a p t e r 1 3 56
  • 57. Click to edit Master title style 57 Modules 57 A group of functions, variables and classes saved to a file, which is nothing but module. Every Python file (.py) acts as a module. main objective : code Reusability ❑ Module aliasing: --------------- to improve reality to prevent name conflicting
  • 58. Click to edit Master title style 58 #Bonus | Best Practices C h a p t e r 1 4 58
  • 59. Click to edit Master title style 59 Best Practices: 59 PEP8 ===> guidelines snake case naming conversion firstname X first_name ----> snake modules, functions, variable ===> should startwith lowercase class ===> should startwith uppercase
  • 60. Click to edit Master title style 60 60 _ => dummy variable for one time use. for _ in range(10): print(_) constant variable should be in upper case. meaningful of variables Comment doc string.....
  • 61. Click to edit Master title style 61 Thank You Like Share Subscribe | Learn Coding