SlideShare a Scribd company logo
Python - Part 1
Getting started with Python
Tradeyathra - Stock market training and forecasting experts
Nicholas I
Agenda
Introduction
Basics
Strings
Control Structures
List, Tuple, Dictionary
Functions
I/O, Exception Handling
Regular Expressions
Modules
Object Oriented Programming
Program & Programming
What is Python?
Where It’s Used?
Installation
Practice
Introduction
Module 1
A Program is a set of instructions that a computer follows to perform a particular
task.
Program
Step 1
Plug the TV wire to
the electric switch
board.
Step 2
Turn your Tv on.
Step 3
Press the power
button on your TV
remote.
Step 4
Switch between the
channels by directly
entering the numbers
from your remote.
How to turn on a tv with remote
Programming is the process of writing your ideas into a program using a computer
language to perform a task.
Programming
Programming languages
● It was created in 1991 by Guido van Rossum.
● Python is an interpreted, interactive, object-oriented programming language.
● Python is a high-level general-purpose programming language that can be
applied to many different classes of problems.
● Python is portable: it runs on many Unix variants, on the Mac, and on Windows
2000 and later
● Easy to learn and understand.
● Simple syntax and Flexible.
What is Python?
Where it is used?
Web and Internet
Development
Scientific & Numeric Games Desktop GUI
Software
Development
Business
Applications
Cloud & Data Center
IoT, Machine
Learning & AI
Installation
Windows
● https://www.python.org/ftp/python/3.6.6/python-3.6.6rc1-webinstall.exe
● Follow the wizard and finish the installation.
● Setup the environment variables.
Mac and Linux
● Mac and Linux comes with python preinstalled.
Practice
Time to set-up
python on your system...
Questions & Answers
Interactive & Script Mode
Comments
Numbers
Variables
Constants
Input and Output
Basics
Module 2
Interactive & Script Mode
Script Mode
Interactive
Comments
# Single Line Comment
# multi
# line
# Comment
""”
Docstring is short for documentation string.
It is a string that occurs as the first statement in a module, function, class, or method definition.
We must write what a function/class does in the docstring.
"""
Numbers
addition >>> 8 + 5
13
subtraction >>> 8 - 5
3
multiplication >>> 8 * 5
13
division >>> 8 / 5
13
exponent >>> 4 ** 3
64
negation >>> -2 + -4
-6
Integer and Float
int >>> 35
35
>>>float >>> 30.5
30.5
An int is a whole number A float is a decimal number
Order of Operations
>>> ( 5 + 7 ) * 3 >>> 5 + 7 * 3
36 26
PEMDAS: Parentheses Exponent Multiplication Division Addition Subtraction
>>> 12 * 3 >>> 5 + 21
Variables
>>> apples_in_box = 10
5
Variable is the container that stores some value.
>>> apples_sold = 5
>>> apples_balance = apples_in_box - apples_sold
5
10
>>> fruit_box = 100
variable name Value to be stored
Naming Variables
Name your variables meaningful and As long as you’re not breaking these rules,
you can name variables anything you want.
no spaces = 0 X No spaces in the name
3eggs, $price X No digits or special characters in front
Constants
Constants are used to store a value that can be used later in your program. The
value of the constant remains same and they do not change.
>>> PI = 3.14
constant name Value to store
>>> GRAVITY = 9.8
Input and Output
>>> input([prompt])
Function to accept
value from users
via cli
Value to be
entered by user
>>> print([output])
Function to output
value to users
Value printed on
the user screen
String Delimiters
Concatenation
Triple quoted string literals
Escape Codes
String Methods
Strings
Module 3
Strings
A string in Python is a sequence of characters. For Python to recognize a
sequence of characters, like hello, as a string, it must be enclosed in quotes to
delimit the string.
>>> "Hello"
Note:
A string can have any number of characters in it, including 0. The empty string is '' (two quote characters with nothing
between them). Many beginners forget that having no characters is legal. It can be useful.
>>> 'Hello'
Concatenation
The plus operation with strings means concatenate the strings. Python looks at
the type of operands before deciding what operation is associated with the +.
>>> "Firstname" + "lastname" >>> 'Hello'
Firstnamelastname
>>> 3 * 'Smart' + 'Phone'
SmartSmartSmartPhone
>>> 7 + "star"
?
Note:
The line structure is preserved in a multi-line string. As you can see, this also allows you to embed
both single and double quote characters!
Triple Quoted String Literals
Strings delimited by one quote character are required to be within a single line.
For example: ‘hello’.It is sometimes convenient to have a multi-line string, which
can be delimited with triple quotes, '''.
Note:
The line structure is preserved in a multi-line string. As you can see, this also allows you to embed
both single and double quote characters!
Escape Codes
Escape codes are embedded inside string literals and start with a backslash
character . They are used to embed characters that are either unprintable or
have a special syntactic meaning to Python that you want to suppress.
String Methods
Python has quite a few methods that string objects can call to perform frequency
occurring task (related to string). For example, if you want to capitalize the first
letter of a string, you can use capitalize() method
capitalize() Converts first character to capital letter
count() Counts the occurrences of a substring
upper() Returns uppercased string
lower() Returns lowercased string
len() Returns length of a string
split() Separates the words in sentences.
split()
if , elif and else
while
for
break
Control
Structures
Module 4
if, elif & else
if condition:
statements
else:
statement
if condition:
statements
elif condition:
statements
else:
statements
a = 0
if a == 0:
print('A is equal to 0')
else:
print('A is not equal to 0')
a = 2
if a == 0:
print('A is equal to 0')
elif a == 1:
print('A is equal to 1')
else:
print('A is not equal to 0 or 1')
The
if…elif…else
statement is
used for
decision
making.
Syntax Syntax
Run Run
Login
uname = 'admin'
pword = 'admin'
# user to enter their usernname & password
usernname = input('username: ')
password = input('password: ')
if usernname == uname and password == pword:
print('Login successful')
else:
print('Sorry! Invalid username and password')
while
Run the statements until a given condition is true.
while condition:
statement
Syntax
movie = 'Spider Man'
while movie == 'Spider Man':
print('Yes! I am Spider Man')
break
Run
for
Loops through elements in sequence & store in a variable
that can be used later in the program.
for variable in sequence:
statement
Syntax
for
# print 0-9 numbers using for loop
for number in range(10):
print(number)
Run
# print all the elements in fruits list
fruits = ['apple','banana','orange']
for fruit in fruits:
print(fruit)
Run
for - nested
countries = ['India','US','China','Europe']
fruits = ['apple','banana','orange']
for country in countries:
for fruit in fruits:
print(country,':', fruit)
print('-----------------')
Run
break
a = 0
while a==0:
print('hello')
Run
a = 0
while a==0:
print('hello')
break
Run
Nicholas I
Tradeyathra
nicholas.domnic.i@gmail.com
Call / Whatsapp : 8050012644
Telegram: t.me/tradeyathra
Thank You

More Related Content

What's hot (20)

PPTX
Functions in Python
Kamal Acharya
 
PDF
Methods in Java
Jussi Pohjolainen
 
PPT
Introduction to Python
amiable_indian
 
PPTX
Introduction to the basics of Python programming (part 1)
Pedro Rodrigues
 
PDF
Date and Time Module in Python | Edureka
Edureka!
 
PPTX
Procedure and Functions in pl/sql
Ñirmal Tatiwal
 
PPTX
Basic Python Programming: Part 01 and Part 02
Fariz Darari
 
PDF
Lesson 02 python keywords and identifiers
Nilimesh Halder
 
PPTX
Virtual base class
Tech_MX
 
PPTX
Polymorphism in Python
Home
 
PPTX
Basics of Object Oriented Programming in Python
Sujith Kumar
 
PPTX
Generators In Python
Simplilearn
 
PDF
Python Programming Language | Python Classes | Python Tutorial | Python Train...
Edureka!
 
PPTX
Introduction to Python Basics Programming
Collaboration Technologies
 
PDF
Python libraries
Prof. Dr. K. Adisesha
 
PPTX
Python Libraries and Modules
RaginiJain21
 
PDF
What is Socket Programming in Python | Edureka
Edureka!
 
PPTX
GUI programming
Vineeta Garg
 
PPTX
Operators in Python
Anusuya123
 
Functions in Python
Kamal Acharya
 
Methods in Java
Jussi Pohjolainen
 
Introduction to Python
amiable_indian
 
Introduction to the basics of Python programming (part 1)
Pedro Rodrigues
 
Date and Time Module in Python | Edureka
Edureka!
 
Procedure and Functions in pl/sql
Ñirmal Tatiwal
 
Basic Python Programming: Part 01 and Part 02
Fariz Darari
 
Lesson 02 python keywords and identifiers
Nilimesh Halder
 
Virtual base class
Tech_MX
 
Polymorphism in Python
Home
 
Basics of Object Oriented Programming in Python
Sujith Kumar
 
Generators In Python
Simplilearn
 
Python Programming Language | Python Classes | Python Tutorial | Python Train...
Edureka!
 
Introduction to Python Basics Programming
Collaboration Technologies
 
Python libraries
Prof. Dr. K. Adisesha
 
Python Libraries and Modules
RaginiJain21
 
What is Socket Programming in Python | Edureka
Edureka!
 
GUI programming
Vineeta Garg
 
Operators in Python
Anusuya123
 

Similar to Get started python programming part 1 (20)

PDF
Python intro
Abhinav Upadhyay
 
PPTX
Python basics
Hoang Nguyen
 
PPTX
Python basics
Luis Goldster
 
PPTX
Python basics
Tony Nguyen
 
PPTX
Python basics
Fraboni Ec
 
PPTX
Python basics
Harry Potter
 
PPTX
Python basics
Young Alista
 
PPTX
Python basics
James Wong
 
PPTX
Python ppt
Anush verma
 
PDF
python_strings.pdf
rajendraprasadbabub1
 
PPTX
Python Strings and strings types with Examples
Prof. Kartiki Deshmukh
 
PPTX
An Introduction To Python - Python Midterm Review
Blue Elephant Consulting
 
PDF
Notes1
hccit
 
PPTX
UNIT 4 python.pptx
TKSanthoshRao
 
PPTX
Python
MeHak Gulati
 
PDF
ACM init() Spring 2015 Day 1
UCLA Association of Computing Machinery
 
PPTX
Introduction to Python Programming .pptx
NaynaSagarDahatonde
 
PPTX
#Code2Create: Python Basics
GDGKuwaitGoogleDevel
 
PPTX
Python
Gagandeep Nanda
 
PPTX
Chapter1 python introduction syntax general
ssuser77162c
 
Python intro
Abhinav Upadhyay
 
Python basics
Hoang Nguyen
 
Python basics
Luis Goldster
 
Python basics
Tony Nguyen
 
Python basics
Fraboni Ec
 
Python basics
Harry Potter
 
Python basics
Young Alista
 
Python basics
James Wong
 
Python ppt
Anush verma
 
python_strings.pdf
rajendraprasadbabub1
 
Python Strings and strings types with Examples
Prof. Kartiki Deshmukh
 
An Introduction To Python - Python Midterm Review
Blue Elephant Consulting
 
Notes1
hccit
 
UNIT 4 python.pptx
TKSanthoshRao
 
Python
MeHak Gulati
 
ACM init() Spring 2015 Day 1
UCLA Association of Computing Machinery
 
Introduction to Python Programming .pptx
NaynaSagarDahatonde
 
#Code2Create: Python Basics
GDGKuwaitGoogleDevel
 
Chapter1 python introduction syntax general
ssuser77162c
 
Ad

Recently uploaded (20)

PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PPTX
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
PDF
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
PDF
Introduction presentation of the patentbutler tool
MIPLM
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
DAY 1_QUARTER1 ENGLISH 5 WEEK- PRESENTATION.pptx
BanyMacalintal
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PDF
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
PDF
Council of Chalcedon Re-Examined
Smiling Lungs
 
PPTX
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
PPTX
Difference between write and update in odoo 18
Celine George
 
PPTX
Introduction to Indian Writing in English
Trushali Dodiya
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PPTX
TRANSLATIONAL AND ROTATIONAL MOTION.pptx
KIPAIZAGABAWA1
 
PPTX
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
PDF
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
PDF
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
Introduction presentation of the patentbutler tool
MIPLM
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
DAY 1_QUARTER1 ENGLISH 5 WEEK- PRESENTATION.pptx
BanyMacalintal
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
Council of Chalcedon Re-Examined
Smiling Lungs
 
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
Difference between write and update in odoo 18
Celine George
 
Introduction to Indian Writing in English
Trushali Dodiya
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
TRANSLATIONAL AND ROTATIONAL MOTION.pptx
KIPAIZAGABAWA1
 
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
Ad

Get started python programming part 1

  • 1. Python - Part 1 Getting started with Python Tradeyathra - Stock market training and forecasting experts Nicholas I
  • 2. Agenda Introduction Basics Strings Control Structures List, Tuple, Dictionary Functions I/O, Exception Handling Regular Expressions Modules Object Oriented Programming
  • 3. Program & Programming What is Python? Where It’s Used? Installation Practice Introduction Module 1
  • 4. A Program is a set of instructions that a computer follows to perform a particular task. Program Step 1 Plug the TV wire to the electric switch board. Step 2 Turn your Tv on. Step 3 Press the power button on your TV remote. Step 4 Switch between the channels by directly entering the numbers from your remote. How to turn on a tv with remote
  • 5. Programming is the process of writing your ideas into a program using a computer language to perform a task. Programming Programming languages
  • 6. ● It was created in 1991 by Guido van Rossum. ● Python is an interpreted, interactive, object-oriented programming language. ● Python is a high-level general-purpose programming language that can be applied to many different classes of problems. ● Python is portable: it runs on many Unix variants, on the Mac, and on Windows 2000 and later ● Easy to learn and understand. ● Simple syntax and Flexible. What is Python?
  • 7. Where it is used? Web and Internet Development Scientific & Numeric Games Desktop GUI Software Development Business Applications Cloud & Data Center IoT, Machine Learning & AI
  • 8. Installation Windows ● https://www.python.org/ftp/python/3.6.6/python-3.6.6rc1-webinstall.exe ● Follow the wizard and finish the installation. ● Setup the environment variables. Mac and Linux ● Mac and Linux comes with python preinstalled.
  • 9. Practice Time to set-up python on your system...
  • 11. Interactive & Script Mode Comments Numbers Variables Constants Input and Output Basics Module 2
  • 12. Interactive & Script Mode Script Mode Interactive
  • 13. Comments # Single Line Comment # multi # line # Comment ""” Docstring is short for documentation string. It is a string that occurs as the first statement in a module, function, class, or method definition. We must write what a function/class does in the docstring. """
  • 14. Numbers addition >>> 8 + 5 13 subtraction >>> 8 - 5 3 multiplication >>> 8 * 5 13 division >>> 8 / 5 13 exponent >>> 4 ** 3 64 negation >>> -2 + -4 -6
  • 15. Integer and Float int >>> 35 35 >>>float >>> 30.5 30.5 An int is a whole number A float is a decimal number
  • 16. Order of Operations >>> ( 5 + 7 ) * 3 >>> 5 + 7 * 3 36 26 PEMDAS: Parentheses Exponent Multiplication Division Addition Subtraction >>> 12 * 3 >>> 5 + 21
  • 17. Variables >>> apples_in_box = 10 5 Variable is the container that stores some value. >>> apples_sold = 5 >>> apples_balance = apples_in_box - apples_sold 5 10 >>> fruit_box = 100 variable name Value to be stored
  • 18. Naming Variables Name your variables meaningful and As long as you’re not breaking these rules, you can name variables anything you want. no spaces = 0 X No spaces in the name 3eggs, $price X No digits or special characters in front
  • 19. Constants Constants are used to store a value that can be used later in your program. The value of the constant remains same and they do not change. >>> PI = 3.14 constant name Value to store >>> GRAVITY = 9.8
  • 20. Input and Output >>> input([prompt]) Function to accept value from users via cli Value to be entered by user >>> print([output]) Function to output value to users Value printed on the user screen
  • 21. String Delimiters Concatenation Triple quoted string literals Escape Codes String Methods Strings Module 3
  • 22. Strings A string in Python is a sequence of characters. For Python to recognize a sequence of characters, like hello, as a string, it must be enclosed in quotes to delimit the string. >>> "Hello" Note: A string can have any number of characters in it, including 0. The empty string is '' (two quote characters with nothing between them). Many beginners forget that having no characters is legal. It can be useful. >>> 'Hello'
  • 23. Concatenation The plus operation with strings means concatenate the strings. Python looks at the type of operands before deciding what operation is associated with the +. >>> "Firstname" + "lastname" >>> 'Hello' Firstnamelastname >>> 3 * 'Smart' + 'Phone' SmartSmartSmartPhone >>> 7 + "star" ?
  • 24. Note: The line structure is preserved in a multi-line string. As you can see, this also allows you to embed both single and double quote characters! Triple Quoted String Literals Strings delimited by one quote character are required to be within a single line. For example: ‘hello’.It is sometimes convenient to have a multi-line string, which can be delimited with triple quotes, '''.
  • 25. Note: The line structure is preserved in a multi-line string. As you can see, this also allows you to embed both single and double quote characters! Escape Codes Escape codes are embedded inside string literals and start with a backslash character . They are used to embed characters that are either unprintable or have a special syntactic meaning to Python that you want to suppress.
  • 26. String Methods Python has quite a few methods that string objects can call to perform frequency occurring task (related to string). For example, if you want to capitalize the first letter of a string, you can use capitalize() method capitalize() Converts first character to capital letter count() Counts the occurrences of a substring upper() Returns uppercased string lower() Returns lowercased string len() Returns length of a string split() Separates the words in sentences.
  • 28. if , elif and else while for break Control Structures Module 4
  • 29. if, elif & else if condition: statements else: statement if condition: statements elif condition: statements else: statements a = 0 if a == 0: print('A is equal to 0') else: print('A is not equal to 0') a = 2 if a == 0: print('A is equal to 0') elif a == 1: print('A is equal to 1') else: print('A is not equal to 0 or 1') The if…elif…else statement is used for decision making. Syntax Syntax Run Run
  • 30. Login uname = 'admin' pword = 'admin' # user to enter their usernname & password usernname = input('username: ') password = input('password: ') if usernname == uname and password == pword: print('Login successful') else: print('Sorry! Invalid username and password')
  • 31. while Run the statements until a given condition is true. while condition: statement Syntax movie = 'Spider Man' while movie == 'Spider Man': print('Yes! I am Spider Man') break Run
  • 32. for Loops through elements in sequence & store in a variable that can be used later in the program. for variable in sequence: statement Syntax
  • 33. for # print 0-9 numbers using for loop for number in range(10): print(number) Run # print all the elements in fruits list fruits = ['apple','banana','orange'] for fruit in fruits: print(fruit) Run
  • 34. for - nested countries = ['India','US','China','Europe'] fruits = ['apple','banana','orange'] for country in countries: for fruit in fruits: print(country,':', fruit) print('-----------------') Run
  • 35. break a = 0 while a==0: print('hello') Run a = 0 while a==0: print('hello') break Run
  • 36. Nicholas I Tradeyathra [email protected] Call / Whatsapp : 8050012644 Telegram: t.me/tradeyathra Thank You