SlideShare a Scribd company logo
Introduction to
Python
Welcome
Congratulations for deciding to participate
in a 7 days of Introduction to Python
Course.
In this course you will learn the basics of
programming using Python.
Course Introduction
This course is designed for beginners and
intermediate who want to learn python
programming language.
In this course the topics are broken down
into 7 days, where each day contains several
topics with easy-to-understand
explanations, real-world examples, many
hands on exercises and a final project.
Why Python?
Python is a programming language which is
very close to human language and because
of that it is easy to learn and use.
Python is used by various industries and
companies (including Google).
It has been used to develop web
applications, desktop applications, system
administration, and machine learning
libraries.
Installing Python
 To run a python script you need to install python.
Let's download python from
https://www.python.org/.
Installing VS Code
 Visual Studio Code is a code editor (much like
any other editor like Notepad) helpful in writing
and editing codes.
 We download it from here
https://code.visualstudio.com/
Basic Data-types
 Boolean
A boolean data type is either a True or False value. T and F
should be always uppercase.
 Integers (default for numbers)
z = 5
 Floats
x = 3.1416
 Complex Numbers
x = 1+2j
Basic Data-types
 Strings
• Can use “ ” or ‘ ’ to specify strings
• a = “Nepal”
• b = ‘Kantipur Engineering College’
• “abc” == ‘abc’
• Use “ ” if ’ already in string eg: “matt’s”
• Use triple double-quotes for multi-line strings or strings
than contain both ‘ and “ inside of them:
“““a‘b“c”””
Checking Data Types
 To check the data type of certain data/variable we
use the type function.
>>> type(15)
<class ‘int’>
>>> type(3.14)
<class ‘float’>
>>> type(1+2j)
<class ‘complex’>
>>> str = “Hello World”
>>> type(str)
<class ‘string’>
Naming Rules
 Names are case sensitive and cannot start with a
number.
 They can contain letters, numbers, and
underscores.
 bob Bob _bob _2_bob_ bob_2 BoB
 There are some reserved words:
and, assert, break, class, continue, def, del, elif, else,
except, exec, finally, for, from, global, if, import, in, is,
lambda, not, or, pass, print, raise, return, try, while
 Can’t do this
• for = 12 #for is a reserved word
Assignment
 Assign value to variables
>>> x = 2
 You can assign to multiple names at the same time
>>> x, y = 2, 3
>>> x
2
>>> y
3
 This makes it easy to swap values
>>> x, y = y, x
 Assignments can be chained
>>> a = b = x = 2
Mathematical Operators
Mathematical Operators
 Exercise: Find an Euclidian distance between (2, 3) and
(10, 8)
Mathematical Operators
 Exercise: For a given temperature in celsius stored in
variable ‘t_c’, get the Fahrenheit temperature in ‘t_f’ and
display result.
• Let t_c = 100
• ans = 212
Checking Data Types
 Exercise: What would be the data-type of?
>>> a = 4/3
>>> type(a)
>>> n = 4//3
>>> type(a)
>>> num = ‘2080’
>>> type(num)
Type Casting
 Converting one data type to another data type.
 We use int(), float(), str()
>> # float to int
>> gravity = 9.81
>> print(int(gravity))
Type Casting
 When we do arithmetic operations string numbers
should be first converted to int or float otherwise it
will return an error.
>> #str to int or float
>> num_str = '10.6‘
>> print('num_int', int(num_str))
>> print('num_float', float(num_str))
Comparison Operators
Comparison Operators
 In programming we compare values, we use
comparison operators to compare two values. We
check if a value is greater or less or equal to other
value.
>> 2 == 2
>> 3.14 == 3.1416
>> print(123 == ‘123’)
>> print(123 == int(‘123’))
>> a = ‘mango’
>> b = ‘orange’
>> a == b
>> a < b What does this show?
Logical Operators
Logical Operators
 Logical operators are used to combine conditional
statements:
>> 2 == 2 and 2 < 4
True
>> print()
>>
>> a = ‘mango’
>> b = ‘orange’
>> a == b
>> a < b What does this show?
Conditionals
 In python the key word if is used to check if a
condition is true and to execute the block code.
Remember the indentation after the colon.
a = 10
if a > 3:
print(a, “is greater than 3”)
 if else
a = 3
if a > 0:
print(a, “is positive number”)
else:
print(a, “is negative”)
Conditionals
 if elif else
a = 3
if a > 0:
print(a, “is positive number”)
elif a < 0:
print(a, “is negative number”)
else:
print(a, “is zero”)
Operators and Conditionals
 Exercise:
 How do you check if a number is between 5 and 10
inclusive?
Note: Use if statement here
>>> if condition_1 and condition_2:
... choice_1
>>> else:
... choice_2
>>>
Operators and Conditionals
 Exercise:
 How do you check if a number is even or not using
python?
Note: Use if statement here
>>> if condition:
... choice_1
>>> else:
... choice_2
>>>
Program for the Day
Calculate Electricity Bill (15A)
KWh Minimum Charge Charge per KWh
0 to 20 50 4.00
21 to 30 75 6.50
31 to 50 75 8.00
51 to 100 100 9.50
101 to 250 125 9.50
250 above 175 11
Ans: 2330 for 250 units
Loops
 In programming we also do lots of repetitive tasks. In order
to handle repetitive task programming languages use loops.
Python programming language also provides the following
types of two loops:
• while loop
• for loop
While Loop
count = 0
while count < 5:
print(count)
count = count + 1 #prints from 0 to 4
for Loop
# syntax
for iterator in range(start, end, step):
#loop statements
for i in range(1,10,1):
print(i)
for Loop
num_list = [1,2,3,4,5]
for num in num_list:
print(num)
it_companies = ['Facebook', 'Google', 'Microsoft',
'Apple', 'IBM', 'Oracle',
‘Amazon‘]
for company in it_companies:
print(company)
Program for the Day
Student Grading SEE and NEB
Program for the Day
Student Grading SEE and NEB
 For a given students’ mark in percentage, display
letter grade for each student.
marks = 90
Your code should display “Outstanding”
Program for the Day
Student Grading SEE and NEB
 For a list of students’ marks in percentage, display
letter grade for each student.
marks = [95, 42, 78, 45, 89, 90]
Use for loop
Ad

More Related Content

Similar to introduction to python in english presentation file (20)

Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
DRVaibhavmeshram1
 
Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)
ExcellenceAcadmy
 
Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)
ExcellenceAcadmy
 
Introduction To Python.pptx
Introduction To Python.pptxIntroduction To Python.pptx
Introduction To Python.pptx
Anum Zehra
 
Python programing
Python programingPython programing
Python programing
hamzagame
 
Python programming
Python  programmingPython  programming
Python programming
Ashwin Kumar Ramasamy
 
TOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdfTOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdf
EjazAlam23
 
Python Control structures
Python Control structuresPython Control structures
Python Control structures
Siddique Ibrahim
 
Review of C programming language.pptx...
Review of C programming language.pptx...Review of C programming language.pptx...
Review of C programming language.pptx...
SthitaprajnaLenka1
 
Control structures pyhton
Control structures  pyhtonControl structures  pyhton
Control structures pyhton
Prakash Jayaraman
 
Chapter 2-Python and control flow statement.pptx
Chapter 2-Python and control flow statement.pptxChapter 2-Python and control flow statement.pptx
Chapter 2-Python and control flow statement.pptx
atharvdeshpande20
 
Basic Concepts in Python
Basic Concepts in PythonBasic Concepts in Python
Basic Concepts in Python
Sumit Satam
 
Keep it Stupidly Simple Introduce Python
Keep it Stupidly Simple Introduce PythonKeep it Stupidly Simple Introduce Python
Keep it Stupidly Simple Introduce Python
SushJalai
 
Welcome to python workshop
Welcome to python workshopWelcome to python workshop
Welcome to python workshop
Mukul Kirti Verma
 
Python_Haegl.powerpoint presentation. tx
Python_Haegl.powerpoint presentation. txPython_Haegl.powerpoint presentation. tx
Python_Haegl.powerpoint presentation. tx
vishwanathgoudapatil1
 
Python
PythonPython
Python
Aashish Jain
 
‘How to develop Pythonic coding rather than Python coding – Logic Perspective’
‘How to develop Pythonic coding rather than Python coding – Logic Perspective’‘How to develop Pythonic coding rather than Python coding – Logic Perspective’
‘How to develop Pythonic coding rather than Python coding – Logic Perspective’
S.Mohideen Badhusha
 
03 and 04 .Operators, Expressions, working with the console and conditional s...
03 and 04 .Operators, Expressions, working with the console and conditional s...03 and 04 .Operators, Expressions, working with the console and conditional s...
03 and 04 .Operators, Expressions, working with the console and conditional s...
Intro C# Book
 
Python knowledge ,......................
Python knowledge ,......................Python knowledge ,......................
Python knowledge ,......................
sabith777a
 
Help with Pyhon Programming Homework
Help with Pyhon Programming HomeworkHelp with Pyhon Programming Homework
Help with Pyhon Programming Homework
Helpmeinhomework
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
DRVaibhavmeshram1
 
Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)Python Training in Chandigarh(Mohali)
Python Training in Chandigarh(Mohali)
ExcellenceAcadmy
 
Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)Python Training Course in Chandigarh(Mohali)
Python Training Course in Chandigarh(Mohali)
ExcellenceAcadmy
 
Introduction To Python.pptx
Introduction To Python.pptxIntroduction To Python.pptx
Introduction To Python.pptx
Anum Zehra
 
Python programing
Python programingPython programing
Python programing
hamzagame
 
TOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdfTOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdf
EjazAlam23
 
Review of C programming language.pptx...
Review of C programming language.pptx...Review of C programming language.pptx...
Review of C programming language.pptx...
SthitaprajnaLenka1
 
Chapter 2-Python and control flow statement.pptx
Chapter 2-Python and control flow statement.pptxChapter 2-Python and control flow statement.pptx
Chapter 2-Python and control flow statement.pptx
atharvdeshpande20
 
Basic Concepts in Python
Basic Concepts in PythonBasic Concepts in Python
Basic Concepts in Python
Sumit Satam
 
Keep it Stupidly Simple Introduce Python
Keep it Stupidly Simple Introduce PythonKeep it Stupidly Simple Introduce Python
Keep it Stupidly Simple Introduce Python
SushJalai
 
Python_Haegl.powerpoint presentation. tx
Python_Haegl.powerpoint presentation. txPython_Haegl.powerpoint presentation. tx
Python_Haegl.powerpoint presentation. tx
vishwanathgoudapatil1
 
‘How to develop Pythonic coding rather than Python coding – Logic Perspective’
‘How to develop Pythonic coding rather than Python coding – Logic Perspective’‘How to develop Pythonic coding rather than Python coding – Logic Perspective’
‘How to develop Pythonic coding rather than Python coding – Logic Perspective’
S.Mohideen Badhusha
 
03 and 04 .Operators, Expressions, working with the console and conditional s...
03 and 04 .Operators, Expressions, working with the console and conditional s...03 and 04 .Operators, Expressions, working with the console and conditional s...
03 and 04 .Operators, Expressions, working with the console and conditional s...
Intro C# Book
 
Python knowledge ,......................
Python knowledge ,......................Python knowledge ,......................
Python knowledge ,......................
sabith777a
 
Help with Pyhon Programming Homework
Help with Pyhon Programming HomeworkHelp with Pyhon Programming Homework
Help with Pyhon Programming Homework
Helpmeinhomework
 

More from RujanTimsina1 (14)

Solar Radiation by Rujan Timsina EEC.ppt
Solar Radiation by Rujan Timsina EEC.pptSolar Radiation by Rujan Timsina EEC.ppt
Solar Radiation by Rujan Timsina EEC.ppt
RujanTimsina1
 
Energy scenario and crisis in nepal by Rujan Timsina , part -1.pptx
Energy scenario and crisis in nepal by Rujan Timsina , part -1.pptxEnergy scenario and crisis in nepal by Rujan Timsina , part -1.pptx
Energy scenario and crisis in nepal by Rujan Timsina , part -1.pptx
RujanTimsina1
 
Energy scenario and crisis in nepal, Rujan Timsina.pptx
Energy scenario and crisis in nepal, Rujan Timsina.pptxEnergy scenario and crisis in nepal, Rujan Timsina.pptx
Energy scenario and crisis in nepal, Rujan Timsina.pptx
RujanTimsina1
 
Lecture 3 Biomass energy...............ppt
Lecture 3 Biomass energy...............pptLecture 3 Biomass energy...............ppt
Lecture 3 Biomass energy...............ppt
RujanTimsina1
 
world energy sources by rujan timsina.pptx
world energy sources by rujan timsina.pptxworld energy sources by rujan timsina.pptx
world energy sources by rujan timsina.pptx
RujanTimsina1
 
RT bio mass or bio energy presentation .ppt
RT bio mass or bio energy presentation .pptRT bio mass or bio energy presentation .ppt
RT bio mass or bio energy presentation .ppt
RujanTimsina1
 
Fuel cell by Rujan Timsina, ioe, tu .pptx
Fuel cell by Rujan Timsina, ioe, tu .pptxFuel cell by Rujan Timsina, ioe, tu .pptx
Fuel cell by Rujan Timsina, ioe, tu .pptx
RujanTimsina1
 
energy scenario in the context of nepal.pptx
energy scenario in the context of nepal.pptxenergy scenario in the context of nepal.pptx
energy scenario in the context of nepal.pptx
RujanTimsina1
 
Thermodynamics Lab manual for students.pptx
Thermodynamics Lab manual for students.pptxThermodynamics Lab manual for students.pptx
Thermodynamics Lab manual for students.pptx
RujanTimsina1
 
Introduction to Energy Engineering Lab manual.pptx
Introduction to Energy Engineering Lab manual.pptxIntroduction to Energy Engineering Lab manual.pptx
Introduction to Energy Engineering Lab manual.pptx
RujanTimsina1
 
00 Introduction to theory of machine.pdf
00 Introduction to theory of machine.pdf00 Introduction to theory of machine.pdf
00 Introduction to theory of machine.pdf
RujanTimsina1
 
Fossil fuel RT rujan timsina .pptx
Fossil fuel RT rujan timsina        .pptxFossil fuel RT rujan timsina        .pptx
Fossil fuel RT rujan timsina .pptx
RujanTimsina1
 
Zero Energy Buildings _ Rujan Timsina-.pptx
Zero Energy Buildings _ Rujan Timsina-.pptxZero Energy Buildings _ Rujan Timsina-.pptx
Zero Energy Buildings _ Rujan Timsina-.pptx
RujanTimsina1
 
Zero Energy Buildings _ Rujan Timsina.pptx
Zero Energy Buildings _ Rujan Timsina.pptxZero Energy Buildings _ Rujan Timsina.pptx
Zero Energy Buildings _ Rujan Timsina.pptx
RujanTimsina1
 
Solar Radiation by Rujan Timsina EEC.ppt
Solar Radiation by Rujan Timsina EEC.pptSolar Radiation by Rujan Timsina EEC.ppt
Solar Radiation by Rujan Timsina EEC.ppt
RujanTimsina1
 
Energy scenario and crisis in nepal by Rujan Timsina , part -1.pptx
Energy scenario and crisis in nepal by Rujan Timsina , part -1.pptxEnergy scenario and crisis in nepal by Rujan Timsina , part -1.pptx
Energy scenario and crisis in nepal by Rujan Timsina , part -1.pptx
RujanTimsina1
 
Energy scenario and crisis in nepal, Rujan Timsina.pptx
Energy scenario and crisis in nepal, Rujan Timsina.pptxEnergy scenario and crisis in nepal, Rujan Timsina.pptx
Energy scenario and crisis in nepal, Rujan Timsina.pptx
RujanTimsina1
 
Lecture 3 Biomass energy...............ppt
Lecture 3 Biomass energy...............pptLecture 3 Biomass energy...............ppt
Lecture 3 Biomass energy...............ppt
RujanTimsina1
 
world energy sources by rujan timsina.pptx
world energy sources by rujan timsina.pptxworld energy sources by rujan timsina.pptx
world energy sources by rujan timsina.pptx
RujanTimsina1
 
RT bio mass or bio energy presentation .ppt
RT bio mass or bio energy presentation .pptRT bio mass or bio energy presentation .ppt
RT bio mass or bio energy presentation .ppt
RujanTimsina1
 
Fuel cell by Rujan Timsina, ioe, tu .pptx
Fuel cell by Rujan Timsina, ioe, tu .pptxFuel cell by Rujan Timsina, ioe, tu .pptx
Fuel cell by Rujan Timsina, ioe, tu .pptx
RujanTimsina1
 
energy scenario in the context of nepal.pptx
energy scenario in the context of nepal.pptxenergy scenario in the context of nepal.pptx
energy scenario in the context of nepal.pptx
RujanTimsina1
 
Thermodynamics Lab manual for students.pptx
Thermodynamics Lab manual for students.pptxThermodynamics Lab manual for students.pptx
Thermodynamics Lab manual for students.pptx
RujanTimsina1
 
Introduction to Energy Engineering Lab manual.pptx
Introduction to Energy Engineering Lab manual.pptxIntroduction to Energy Engineering Lab manual.pptx
Introduction to Energy Engineering Lab manual.pptx
RujanTimsina1
 
00 Introduction to theory of machine.pdf
00 Introduction to theory of machine.pdf00 Introduction to theory of machine.pdf
00 Introduction to theory of machine.pdf
RujanTimsina1
 
Fossil fuel RT rujan timsina .pptx
Fossil fuel RT rujan timsina        .pptxFossil fuel RT rujan timsina        .pptx
Fossil fuel RT rujan timsina .pptx
RujanTimsina1
 
Zero Energy Buildings _ Rujan Timsina-.pptx
Zero Energy Buildings _ Rujan Timsina-.pptxZero Energy Buildings _ Rujan Timsina-.pptx
Zero Energy Buildings _ Rujan Timsina-.pptx
RujanTimsina1
 
Zero Energy Buildings _ Rujan Timsina.pptx
Zero Energy Buildings _ Rujan Timsina.pptxZero Energy Buildings _ Rujan Timsina.pptx
Zero Energy Buildings _ Rujan Timsina.pptx
RujanTimsina1
 
Ad

Recently uploaded (20)

Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
vlsi digital circuits full power point presentation
vlsi digital circuits full power point presentationvlsi digital circuits full power point presentation
vlsi digital circuits full power point presentation
DrSunitaPatilUgaleKK
 
Value Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous SecurityValue Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous Security
Marc Hornbeek
 
Mirada a 12 proyectos desarrollados con BIM.pdf
Mirada a 12 proyectos desarrollados con BIM.pdfMirada a 12 proyectos desarrollados con BIM.pdf
Mirada a 12 proyectos desarrollados con BIM.pdf
topitodosmasdos
 
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Journal of Soft Computing in Civil Engineering
 
Basic Principles for Electronics Students
Basic Principles for Electronics StudentsBasic Principles for Electronics Students
Basic Principles for Electronics Students
cbdbizdev04
 
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
charlesdick1345
 
Elevate Your Workflow
Elevate Your WorkflowElevate Your Workflow
Elevate Your Workflow
NickHuld
 
Fourth Semester BE CSE BCS401 ADA Module 3 PPT.pptx
Fourth Semester BE CSE BCS401 ADA Module 3 PPT.pptxFourth Semester BE CSE BCS401 ADA Module 3 PPT.pptx
Fourth Semester BE CSE BCS401 ADA Module 3 PPT.pptx
VENKATESHBHAT25
 
comparison of motors.pptx 1. Motor Terminology.ppt
comparison of motors.pptx 1. Motor Terminology.pptcomparison of motors.pptx 1. Motor Terminology.ppt
comparison of motors.pptx 1. Motor Terminology.ppt
yadavmrr7
 
Reagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptxReagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptx
AlejandroOdio
 
π0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalizationπ0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalization
NABLAS株式会社
 
BCS401 ADA Second IA Test Question Bank.pdf
BCS401 ADA Second IA Test Question Bank.pdfBCS401 ADA Second IA Test Question Bank.pdf
BCS401 ADA Second IA Test Question Bank.pdf
VENKATESHBHAT25
 
Taking AI Welfare Seriously, In this report, we argue that there is a realist...
Taking AI Welfare Seriously, In this report, we argue that there is a realist...Taking AI Welfare Seriously, In this report, we argue that there is a realist...
Taking AI Welfare Seriously, In this report, we argue that there is a realist...
MiguelMarques372250
 
Crack the Domain with Event Storming By Vivek
Crack the Domain with Event Storming By VivekCrack the Domain with Event Storming By Vivek
Crack the Domain with Event Storming By Vivek
Vivek Srivastava
 
Gas Power Plant for Power Generation System
Gas Power Plant for Power Generation SystemGas Power Plant for Power Generation System
Gas Power Plant for Power Generation System
JourneyWithMe1
 
Dust Suppressants: A Sustainable Approach to Dust Pollution Control
Dust Suppressants: A Sustainable Approach to Dust Pollution ControlDust Suppressants: A Sustainable Approach to Dust Pollution Control
Dust Suppressants: A Sustainable Approach to Dust Pollution Control
Janapriya Roy
 
Mathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdfMathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdf
TalhaShahid49
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITY
ijscai
 
vlsi digital circuits full power point presentation
vlsi digital circuits full power point presentationvlsi digital circuits full power point presentation
vlsi digital circuits full power point presentation
DrSunitaPatilUgaleKK
 
Value Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous SecurityValue Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous Security
Marc Hornbeek
 
Mirada a 12 proyectos desarrollados con BIM.pdf
Mirada a 12 proyectos desarrollados con BIM.pdfMirada a 12 proyectos desarrollados con BIM.pdf
Mirada a 12 proyectos desarrollados con BIM.pdf
topitodosmasdos
 
Basic Principles for Electronics Students
Basic Principles for Electronics StudentsBasic Principles for Electronics Students
Basic Principles for Electronics Students
cbdbizdev04
 
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
DATA-DRIVEN SHOULDER INVERSE KINEMATICS YoungBeom Kim1 , Byung-Ha Park1 , Kwa...
charlesdick1345
 
Elevate Your Workflow
Elevate Your WorkflowElevate Your Workflow
Elevate Your Workflow
NickHuld
 
Fourth Semester BE CSE BCS401 ADA Module 3 PPT.pptx
Fourth Semester BE CSE BCS401 ADA Module 3 PPT.pptxFourth Semester BE CSE BCS401 ADA Module 3 PPT.pptx
Fourth Semester BE CSE BCS401 ADA Module 3 PPT.pptx
VENKATESHBHAT25
 
comparison of motors.pptx 1. Motor Terminology.ppt
comparison of motors.pptx 1. Motor Terminology.pptcomparison of motors.pptx 1. Motor Terminology.ppt
comparison of motors.pptx 1. Motor Terminology.ppt
yadavmrr7
 
Reagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptxReagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptx
AlejandroOdio
 
π0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalizationπ0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalization
NABLAS株式会社
 
BCS401 ADA Second IA Test Question Bank.pdf
BCS401 ADA Second IA Test Question Bank.pdfBCS401 ADA Second IA Test Question Bank.pdf
BCS401 ADA Second IA Test Question Bank.pdf
VENKATESHBHAT25
 
Taking AI Welfare Seriously, In this report, we argue that there is a realist...
Taking AI Welfare Seriously, In this report, we argue that there is a realist...Taking AI Welfare Seriously, In this report, we argue that there is a realist...
Taking AI Welfare Seriously, In this report, we argue that there is a realist...
MiguelMarques372250
 
Crack the Domain with Event Storming By Vivek
Crack the Domain with Event Storming By VivekCrack the Domain with Event Storming By Vivek
Crack the Domain with Event Storming By Vivek
Vivek Srivastava
 
Gas Power Plant for Power Generation System
Gas Power Plant for Power Generation SystemGas Power Plant for Power Generation System
Gas Power Plant for Power Generation System
JourneyWithMe1
 
Dust Suppressants: A Sustainable Approach to Dust Pollution Control
Dust Suppressants: A Sustainable Approach to Dust Pollution ControlDust Suppressants: A Sustainable Approach to Dust Pollution Control
Dust Suppressants: A Sustainable Approach to Dust Pollution Control
Janapriya Roy
 
Mathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdfMathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdf
TalhaShahid49
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
Ad

introduction to python in english presentation file

  • 2. Welcome Congratulations for deciding to participate in a 7 days of Introduction to Python Course. In this course you will learn the basics of programming using Python.
  • 3. Course Introduction This course is designed for beginners and intermediate who want to learn python programming language. In this course the topics are broken down into 7 days, where each day contains several topics with easy-to-understand explanations, real-world examples, many hands on exercises and a final project.
  • 4. Why Python? Python is a programming language which is very close to human language and because of that it is easy to learn and use. Python is used by various industries and companies (including Google). It has been used to develop web applications, desktop applications, system administration, and machine learning libraries.
  • 5. Installing Python  To run a python script you need to install python. Let's download python from https://www.python.org/.
  • 6. Installing VS Code  Visual Studio Code is a code editor (much like any other editor like Notepad) helpful in writing and editing codes.  We download it from here https://code.visualstudio.com/
  • 7. Basic Data-types  Boolean A boolean data type is either a True or False value. T and F should be always uppercase.  Integers (default for numbers) z = 5  Floats x = 3.1416  Complex Numbers x = 1+2j
  • 8. Basic Data-types  Strings • Can use “ ” or ‘ ’ to specify strings • a = “Nepal” • b = ‘Kantipur Engineering College’ • “abc” == ‘abc’ • Use “ ” if ’ already in string eg: “matt’s” • Use triple double-quotes for multi-line strings or strings than contain both ‘ and “ inside of them: “““a‘b“c”””
  • 9. Checking Data Types  To check the data type of certain data/variable we use the type function. >>> type(15) <class ‘int’> >>> type(3.14) <class ‘float’> >>> type(1+2j) <class ‘complex’> >>> str = “Hello World” >>> type(str) <class ‘string’>
  • 10. Naming Rules  Names are case sensitive and cannot start with a number.  They can contain letters, numbers, and underscores.  bob Bob _bob _2_bob_ bob_2 BoB  There are some reserved words: and, assert, break, class, continue, def, del, elif, else, except, exec, finally, for, from, global, if, import, in, is, lambda, not, or, pass, print, raise, return, try, while  Can’t do this • for = 12 #for is a reserved word
  • 11. Assignment  Assign value to variables >>> x = 2  You can assign to multiple names at the same time >>> x, y = 2, 3 >>> x 2 >>> y 3  This makes it easy to swap values >>> x, y = y, x  Assignments can be chained >>> a = b = x = 2
  • 13. Mathematical Operators  Exercise: Find an Euclidian distance between (2, 3) and (10, 8)
  • 14. Mathematical Operators  Exercise: For a given temperature in celsius stored in variable ‘t_c’, get the Fahrenheit temperature in ‘t_f’ and display result. • Let t_c = 100 • ans = 212
  • 15. Checking Data Types  Exercise: What would be the data-type of? >>> a = 4/3 >>> type(a) >>> n = 4//3 >>> type(a) >>> num = ‘2080’ >>> type(num)
  • 16. Type Casting  Converting one data type to another data type.  We use int(), float(), str() >> # float to int >> gravity = 9.81 >> print(int(gravity))
  • 17. Type Casting  When we do arithmetic operations string numbers should be first converted to int or float otherwise it will return an error. >> #str to int or float >> num_str = '10.6‘ >> print('num_int', int(num_str)) >> print('num_float', float(num_str))
  • 19. Comparison Operators  In programming we compare values, we use comparison operators to compare two values. We check if a value is greater or less or equal to other value. >> 2 == 2 >> 3.14 == 3.1416 >> print(123 == ‘123’) >> print(123 == int(‘123’)) >> a = ‘mango’ >> b = ‘orange’ >> a == b >> a < b What does this show?
  • 21. Logical Operators  Logical operators are used to combine conditional statements: >> 2 == 2 and 2 < 4 True >> print() >> >> a = ‘mango’ >> b = ‘orange’ >> a == b >> a < b What does this show?
  • 22. Conditionals  In python the key word if is used to check if a condition is true and to execute the block code. Remember the indentation after the colon. a = 10 if a > 3: print(a, “is greater than 3”)  if else a = 3 if a > 0: print(a, “is positive number”) else: print(a, “is negative”)
  • 23. Conditionals  if elif else a = 3 if a > 0: print(a, “is positive number”) elif a < 0: print(a, “is negative number”) else: print(a, “is zero”)
  • 24. Operators and Conditionals  Exercise:  How do you check if a number is between 5 and 10 inclusive? Note: Use if statement here >>> if condition_1 and condition_2: ... choice_1 >>> else: ... choice_2 >>>
  • 25. Operators and Conditionals  Exercise:  How do you check if a number is even or not using python? Note: Use if statement here >>> if condition: ... choice_1 >>> else: ... choice_2 >>>
  • 26. Program for the Day Calculate Electricity Bill (15A) KWh Minimum Charge Charge per KWh 0 to 20 50 4.00 21 to 30 75 6.50 31 to 50 75 8.00 51 to 100 100 9.50 101 to 250 125 9.50 250 above 175 11 Ans: 2330 for 250 units
  • 27. Loops  In programming we also do lots of repetitive tasks. In order to handle repetitive task programming languages use loops. Python programming language also provides the following types of two loops: • while loop • for loop
  • 28. While Loop count = 0 while count < 5: print(count) count = count + 1 #prints from 0 to 4
  • 29. for Loop # syntax for iterator in range(start, end, step): #loop statements for i in range(1,10,1): print(i)
  • 30. for Loop num_list = [1,2,3,4,5] for num in num_list: print(num) it_companies = ['Facebook', 'Google', 'Microsoft', 'Apple', 'IBM', 'Oracle', ‘Amazon‘] for company in it_companies: print(company)
  • 31. Program for the Day Student Grading SEE and NEB
  • 32. Program for the Day Student Grading SEE and NEB  For a given students’ mark in percentage, display letter grade for each student. marks = 90 Your code should display “Outstanding”
  • 33. Program for the Day Student Grading SEE and NEB  For a list of students’ marks in percentage, display letter grade for each student. marks = [95, 42, 78, 45, 89, 90] Use for loop