SlideShare uma empresa Scribd logo
1 de 41
PYN101 – Quick Introduction to Coding Using
Python
www.ocdatabases.com
slides.1@ocdatabases.com
949-489-1472
Quick Introduction to coding using Python
• If you have not done so already please fill out your student
questionnaire online as shown or submit them to your
instructor
• Enjoy programming in Python!
PYN101 Quick Introduction to Coding using
Python
• Introduction (s)
• Facilities
• Course Packet (May vary by course and class)
– Student Questionnaire
– Collaterals (Maps, Catalog, Etc.)
– PowerPoint slide deck
– Evaluation form
– Training certificate
4
Quick Introduction to Coding Using Python
I. Introduction to Programming
II. Creating Simple Programs
III. Creating Programs Using Functions
IV. Implementing the Object-Oriented Methodology
V. Handling Programming Errors
I. Introduction to Programming
 History
 Programming Environments
 Overview of Programming
 Introduction to the Software Development Life Cycle
Copyright © 2011 Element K Content LLC. All rights reserved.
History of Python
Programming Environments
Program
salary1=1000
salary2=2000
sum=salary1 + salary2
print("The sum of two salaries is: {}".format(sum))
isSal2Larger = salary1 > salary2
print("Salary2 is larger than salary 1: {}".format(isSal2Larger))
serviceYears1 = 10
serviceYears2 = 5
isYears2Longer = serviceYears2 > serviceYears1
print("Salary2 is larger than salary 1 because their years of
service is longer: {} ". 
format(isSal2Larger and isYears2Longer))
Program Interpreter Results
Program written in
scripting language
Program written in
scripting language
Program displays
results
Program displays
results
Instructions
(statements) written
in Python
Instructions
(statements) written
in Python
Syntax
Keyword used to
create a class
Keyword used to
create a class
Punctuation used to create a
Statement block
Punctuation used to create a
Statement blockclass EmployeeDetails:
#class methods
#initialize instance variables
def init (self, num, name, sal):
self.empNo = num
self.empName = name
self.salary = float(sal)
def computeAllow(self):
return self.salary * 0.05
def computeNetSal(self):
return self.salary - self.computeAllow()
def getName(self):
return self.empName
Statements indented
inside block
Statements indented
inside block
The Programming Life Cycle
Coding
Executing
Debugging
Program containing
an error
Program containing
an error
Instructions written in
a scripting language
Instructions written in
a scripting language
Internal BytecodeInternal BytecodeSource codeSource code
The Python Platform Process
Edit
Verify
Load
Interpret
Phases in the Python
platform process
Phases in the Python
platform process
The Software Development Life Cycle
Maintenance
Testing
Analysis
Software Development
Life Cycle
Implementation Development
Design
Reflective Questions
1. Which programming methodologies do you suggest for your
organization?
2. Will you follow the SDLC approach to developing software in your
company? Why?
II. Creating Simple Programs
 Work with Variables
 Work with Operators
 Control Program Execution
 Work with Lists
Variables
salary = 1750
if salary > 2500:
print ("Salary is greater than 2500")
else:
print ("Salary is less than 2500")
Variable NameVariable Name
Value stored
in the variable
Value stored
in the variable
Operators
salary1=1000
salary2=2000
sum=salary1 + salary2
print ("The sum of the two salaries is %6.2f" % sum)
Expression used to
calculate the sum of
salaries. The result
always on the left.
Expression used to
calculate the sum of
salaries. The result
always on the left.
OperandOperand
Data used in the
expression
Data used in the
expression
The addition operatorThe addition operator
The if Statement
salary = 1750
if salary > 2500:
print("nSalary is greater than 2500")
salary = salary + (0.03 * salary)
Keyword used to
create an if
conditional statement
Keyword used to
create an if
conditional statement
Action StatementAction Statement
Test conditionTest condition
The if...else Statement
salary = 1750
if salary > 2500:
print("nSalary is greater than 2500")
salary = salary + (0.03 * salary)
else:
print("nSalary is less than 2500")
salary = salary + (0.05 * salary)
print("Adjusted salary: {}".format(salary))
Test conditionTest condition
Keyword used to
create if block
Keyword used to
create if block
Keyword used to
create else block
Keyword used to
create else block
Statements to execute
when the test
condition returns true
Statements to execute
when the test
condition returns true
Statements to execute
when the test
condition returns false
Statements to execute
when the test
condition returns false
The elif Statement
if day == 1:
print ("Monday")
elif day == 2:
print ("Tuesday")
elif day == 3:
print ("Wednesday")
elif day == 4:
print ("Thursday")
elif day == 5:
print ("Friday")
elif day == 6:
print ("Saturday")
elif day == 7:
print ("Sunday")
else:
print ("Invalid day value")
Declared with the
elif keyword
Declared with the
elif keyword
Default statementDefault statement
Repeated elif
statements
Repeated elif
statements
Test conditionTest condition
The while Loop
counter = 10
i = 1
#while loop - tests before entering the loop
#make sure the loop variables are initialized
print ("Basic while loop")
while i <= counter:
print("i = {}".format(i))
i = i + 1
Statements to execute
when the test condition
returns true
Statements to execute
when the test condition
returns true
Declared with the
while keyword
Declared with the
while keyword
Test conditionTest condition
Note: there is no do …while … in Python
The for Loop
sum = 0
counter = 15
for i in range(1,counter+1):
sum = sum + i;
print("i = {}".format(sum))
Statement(s) executed
while variable within
sequence range
Statement(s) executed
while variable within
sequence range
Iterating variable declarationIterating variable declaration sequence
expression
sequence
expression
Declared with the
for keyword
Declared with the
for keyword
Lists
marks = [85, 60, 78, 73, 84]
1 2 30
6085 78 73 84
4
List elementsList elements
List initializationList initialization
List nameList name
List IndexList Index
Graphical representation
of list
Graphical representation
of list
Multidimensional Lists
salary2 =[[12000, 13000,14000], [10000,15000,2000]]
tmpsalary = salary2[1][2]
LIst IndexLIst Index
1300012000 14000
1500010000 20000
0100 02
1110 12
Value stored in
the list element
Value stored in
the list element
Graphical representation
of a two-dimensional list
Graphical representation
of a two-dimensional list
List elementsList elements
LIst nameLIst name
Other data structures
• Tuples
t=(12,15,90)
• Dictionaries
d={“name”:”dan”, “phone”:123-456-7890”}
• Sets
• And more
• We will cover these in our more formal programming classes
• There are also modules for manipulating datasets and big data
Reflective Questions
1. What factors do you consider when you declare a variable?
2. How do arrays help you in your job role?
III. Creating Programs Using Functions
 Create Functions
 Work with Built-in Functions
Functions
def calcNetSalary(allowance, sal):
deduction = allowance/100 * sal
print ("The deduction is ${:,.2f}".format(deduction))
netSal = sal - deduction
return netSal
Method bodyMethod body
DeclarationDeclaration
Method nameMethod name ParametersParameters
Function Calls
def print_salary():
#initialize variables
salary = 12000.0
print("The current salary is ${:,.2f}".format(salary))
#calculate net salary by calling a function
netSalary = calcNetSalary(5, salary)
print("The net salary is ${:,.2f}".format(netSalary))
#function to calculate the net salary
def calcNetSalary(allowance, sal):
deduction = allowance/100 * sal
print ("The deduction is ${:,.2f}".format(deduction))
netSal = sal - deduction
return netSal
Function callFunction call
Function
declaration
Function
declaration
Importing modules
import os
print (os.getcwd())
print (os.listdir('.'))
Import declarationImport declaration
Function callsFunction calls
The Python ecosystem includes a huge library of functions across
many domains. This is one of Python’s strong points and is a major
reason for its popularity.
Reflective Questions
1. In what ways does importing modules help you in your job role?
Discuss.
2. Why would you prefer built-in functions rather than defining your
own functions? Discuss.
IV. Implementing the Object-Oriented
Methodology
 Create a Class
 Create an Object
 Create a Constructor
 Create a Subclass
Classes
class EmployeeDetails:
#class methods
#initialize instance variables
def init (self, num, name, sal):
self.empNo = num
self.empName = name
self.salary = float(sal)
def computeAllow(self):
return self.salary * 0.05
def computeNetSal(self):
return self.salary - self.computeAllow()
def getName(self):
return self.empName
Methods in
the class
Methods in
the class
Class name preceded by
the class keyword
Class name preceded by
the class keyword
Instance
variables
Instance
variables
Objects
import employeedetails as ed
#create employee object
empObj = ed.EmployeeDetails()
#get id and name
id=int(input("Please enter employee id: "))
name=input("Please enter employee name: ")
sal=input("PLease enter salary: ")
#calc net salary
empObj.init(id,name,sal)
netSal=empObj.computeNetSal()
print ("Employee details...")
print ("%s with id %d has a salary of $%6.2f"
% (name, id, netSal))
Object nameObject name
Data stored
in object
empObj
Data stored
in object
empObj
Object used to store
employee data
Object used to store
employee data
data for
employee
data for
employee
Class nameClass name
The self Keyword
class EmployeeDetails:
#class methods
#initialize instance variables
def init (self, num, name, sal):
self.empNo = num
self.empName = name
self.salary = float(sal)
def computeAllow(self):
return self.salary * 0.05
def computeNetSal(self):
return self.salary - self.computeAllow()
def getName(self):
return self.empName
Class nameClass name
The self keyword
used to access
instance variables
from within a method
The self keyword
used to access
instance variables
from within a method
Constructors
class EmployeeDetails2:
#class methods
#constructor (initializer) with defaults
def __init__(self, num=0, name='Unknown', sal=0.0):
self.empNo = num
self.empName = name
self.salary = float(sal)
def computeAllow(self):
return self.salary * 0.05
def computeNetSal(self):
return self.salary - self.computeAllow()
def getName(self):
return self.empName
Class nameClass name
Code to initialize the
class
Code to initialize the
class
Constructor parametersConstructor parameters
ConstructorConstructor
Objects using constructor
import employeedetails2 as ed
#get id and name
id=int(input("Please enter employee id: "))
name=input("Please enter employee name: ")
sal=input("Please enter salary: ")
#create employee object using constructor
empObj = ed.EmployeeDetails2(id,name,sal)
#calc net salary
netSal=empObj.computeNetSal()
print ("Employee details...")
print ("%s with id %d has a salary of $%6.2f"
% (name, id, netSal))
Data stored
in object
empObj
Data stored
in object
empObj
Object nameObject name
Class nameClass name
Object nameObject name
Subclasses
from employeedetails2 import EmployeeDetails2
class ProjectMgr(EmployeeDetails2):
#class methods
#constructor (calls superclass) with defaults
def __init__(self, num=0, name='Unknown',
sal=0.0, sub=0):
super().__init__(num, name, sal)
self.numSubordinates = sub
#override calculate net salary
#replace allowance with bonus
def computeNetSal(self):
return self.salary + self.salary * 0.10
#new method to get nbr of subordinates
def getSubordinates(self):
return self.numSubordinates
Keyword used to
call superclass
Keyword used to
call superclass
SubclassSubclass Parent
(super) class
Parent
(super) class
Default values for
constructor
Default values for
constructor
overidden methodoveridden method
New method
extends
functionality
New method
extends
functionality
Instantiate subclass
import projectmgr as pm
#get id and name
id=int(input("Please enter employee id: "))
if id != 0:
name=input("Please enter employee name: ")
sal=input("Please enter salary: ")
subs=int(input("Please enter # subordinates: "))
#create employee object
pmObj = pm.ProjectMgr(id, name, sal, subs)
else:
pmObj = pm.ProjectMgr()
#calc net salary
print ("Employee details...")
print ("%s with id %d has a salary of $%6.2f"
% (pmObj.getName(), id, pmObj.computeNetSal()))
print ("%s with id %d has a %d subordinates"
% (pmObj.getName(), id, pmObj.getSubordinates()))
Create pm object
with arguments
Create pm object
with arguments
Get values for
constructor
Get values for
constructor
Crate default pm
object
Crate default pm
object
Call methods,;
note getName is in
Call methods,;
note getName is in
Reflective Questions
1. Discuss the advantages of using objects in your program.
2. In what ways does method overloading and overriding help you as
you create software in your job role?
Quick introduction to coding using Python
• Please fill out your evaluations online as shown or submit
them to your instructor
• Enjoy programming in Python!

Mais conteúdo relacionado

Semelhante a Introduction to coding using Python

LINQ Inside
LINQ InsideLINQ Inside
LINQ Insidejeffz
 
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdfProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdflailoesakhan
 
Pythonlearn-04-Functions (1).pptx
Pythonlearn-04-Functions (1).pptxPythonlearn-04-Functions (1).pptx
Pythonlearn-04-Functions (1).pptxleavatin
 
The Final Programming Project
The Final Programming ProjectThe Final Programming Project
The Final Programming ProjectSage Jacobs
 
Parallel and Async Programming With C#
Parallel and Async Programming With C#Parallel and Async Programming With C#
Parallel and Async Programming With C#Rainer Stropek
 
Webinar - Office 365 & PowerShell : A Match Made in Heaven
Webinar - Office 365 & PowerShell : A Match Made in HeavenWebinar - Office 365 & PowerShell : A Match Made in Heaven
Webinar - Office 365 & PowerShell : A Match Made in HeavenSébastien Levert
 
The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196Mahmoud Samir Fayed
 
Introduction to java 101
Introduction to java 101Introduction to java 101
Introduction to java 101kankemwa Ishaku
 
Flock: Data Science Platform @ CISL
Flock: Data Science Platform @ CISLFlock: Data Science Platform @ CISL
Flock: Data Science Platform @ CISLDatabricks
 
Rifartek Robot Training Course - How to use ClientRobot
Rifartek Robot Training Course - How to use ClientRobotRifartek Robot Training Course - How to use ClientRobot
Rifartek Robot Training Course - How to use ClientRobotTsai Tsung-Yi
 
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshopIntroduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshopMichael Blumenthal (Microsoft MVP)
 
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...Sébastien Levert
 
Format of first slide for main PPT-GIT.pptx
Format of first slide for main PPT-GIT.pptxFormat of first slide for main PPT-GIT.pptx
Format of first slide for main PPT-GIT.pptxMOHAMMADANISH12
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Pythongturnquist
 
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Edureka!
 
Python programming workshop session 1
Python programming workshop session 1Python programming workshop session 1
Python programming workshop session 1Abdul Haseeb
 

Semelhante a Introduction to coding using Python (20)

LINQ Inside
LINQ InsideLINQ Inside
LINQ Inside
 
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdfProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
 
Pythonlearn-04-Functions (1).pptx
Pythonlearn-04-Functions (1).pptxPythonlearn-04-Functions (1).pptx
Pythonlearn-04-Functions (1).pptx
 
The Final Programming Project
The Final Programming ProjectThe Final Programming Project
The Final Programming Project
 
Parallel and Async Programming With C#
Parallel and Async Programming With C#Parallel and Async Programming With C#
Parallel and Async Programming With C#
 
Webinar - Office 365 & PowerShell : A Match Made in Heaven
Webinar - Office 365 & PowerShell : A Match Made in HeavenWebinar - Office 365 & PowerShell : A Match Made in Heaven
Webinar - Office 365 & PowerShell : A Match Made in Heaven
 
The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196
 
Introduction to java 101
Introduction to java 101Introduction to java 101
Introduction to java 101
 
Flock: Data Science Platform @ CISL
Flock: Data Science Platform @ CISLFlock: Data Science Platform @ CISL
Flock: Data Science Platform @ CISL
 
Rifartek Robot Training Course - How to use ClientRobot
Rifartek Robot Training Course - How to use ClientRobotRifartek Robot Training Course - How to use ClientRobot
Rifartek Robot Training Course - How to use ClientRobot
 
Java 101
Java 101Java 101
Java 101
 
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshopIntroduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
 
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
 
Anish PPT-GIT.pptx
Anish PPT-GIT.pptxAnish PPT-GIT.pptx
Anish PPT-GIT.pptx
 
Format of first slide for main PPT-GIT.pptx
Format of first slide for main PPT-GIT.pptxFormat of first slide for main PPT-GIT.pptx
Format of first slide for main PPT-GIT.pptx
 
PPT-GIT.pptx
PPT-GIT.pptxPPT-GIT.pptx
PPT-GIT.pptx
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Python
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
 
Python programming workshop session 1
Python programming workshop session 1Python programming workshop session 1
Python programming workshop session 1
 

Mais de Dan D'Urso

SQL201S Accelerated Introduction to MySQL Queries
SQL201S Accelerated Introduction to MySQL QueriesSQL201S Accelerated Introduction to MySQL Queries
SQL201S Accelerated Introduction to MySQL QueriesDan D'Urso
 
LCD201d Database Diagramming with Lucidchart
LCD201d Database Diagramming with LucidchartLCD201d Database Diagramming with Lucidchart
LCD201d Database Diagramming with LucidchartDan D'Urso
 
Database Normalization
Database NormalizationDatabase Normalization
Database NormalizationDan D'Urso
 
VIS201d Visio Database Diagramming
VIS201d Visio Database DiagrammingVIS201d Visio Database Diagramming
VIS201d Visio Database DiagrammingDan D'Urso
 
PRJ101a Project 2013 Accelerated
PRJ101a Project 2013 AcceleratedPRJ101a Project 2013 Accelerated
PRJ101a Project 2013 AcceleratedDan D'Urso
 
PRJ101xl Project Libre Basic Training
PRJ101xl Project Libre Basic TrainingPRJ101xl Project Libre Basic Training
PRJ101xl Project Libre Basic TrainingDan D'Urso
 
Stem conference
Stem conferenceStem conference
Stem conferenceDan D'Urso
 
SQL200A Microsoft Access SQL Design
SQL200A Microsoft Access SQL DesignSQL200A Microsoft Access SQL Design
SQL200A Microsoft Access SQL DesignDan D'Urso
 
Microsoft access self joins
Microsoft access self joinsMicrosoft access self joins
Microsoft access self joinsDan D'Urso
 
SQL302 Intermediate SQL
SQL302 Intermediate SQLSQL302 Intermediate SQL
SQL302 Intermediate SQLDan D'Urso
 
AIN106 Access Reporting and Analysis
AIN106 Access Reporting and AnalysisAIN106 Access Reporting and Analysis
AIN106 Access Reporting and AnalysisDan D'Urso
 
SQL302 Intermediate SQL Workshop 3
SQL302 Intermediate SQL Workshop 3SQL302 Intermediate SQL Workshop 3
SQL302 Intermediate SQL Workshop 3Dan D'Urso
 
SQL302 Intermediate SQL Workshop 2
SQL302 Intermediate SQL Workshop 2SQL302 Intermediate SQL Workshop 2
SQL302 Intermediate SQL Workshop 2Dan D'Urso
 
Course Catalog
Course CatalogCourse Catalog
Course CatalogDan D'Urso
 
SQL302 Intermediate SQL Workshop 1
SQL302 Intermediate SQL Workshop 1SQL302 Intermediate SQL Workshop 1
SQL302 Intermediate SQL Workshop 1Dan D'Urso
 
SQL212 Oracle SQL Manual
SQL212 Oracle SQL ManualSQL212 Oracle SQL Manual
SQL212 Oracle SQL ManualDan D'Urso
 
SQL201W MySQL SQL Manual
SQL201W MySQL SQL ManualSQL201W MySQL SQL Manual
SQL201W MySQL SQL ManualDan D'Urso
 
SQL206 SQL Median
SQL206 SQL MedianSQL206 SQL Median
SQL206 SQL MedianDan D'Urso
 
SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3
SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3
SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3Dan D'Urso
 

Mais de Dan D'Urso (20)

SQL201S Accelerated Introduction to MySQL Queries
SQL201S Accelerated Introduction to MySQL QueriesSQL201S Accelerated Introduction to MySQL Queries
SQL201S Accelerated Introduction to MySQL Queries
 
LCD201d Database Diagramming with Lucidchart
LCD201d Database Diagramming with LucidchartLCD201d Database Diagramming with Lucidchart
LCD201d Database Diagramming with Lucidchart
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
VIS201d Visio Database Diagramming
VIS201d Visio Database DiagrammingVIS201d Visio Database Diagramming
VIS201d Visio Database Diagramming
 
PRJ101a Project 2013 Accelerated
PRJ101a Project 2013 AcceleratedPRJ101a Project 2013 Accelerated
PRJ101a Project 2013 Accelerated
 
PRJ101xl Project Libre Basic Training
PRJ101xl Project Libre Basic TrainingPRJ101xl Project Libre Basic Training
PRJ101xl Project Libre Basic Training
 
Stem conference
Stem conferenceStem conference
Stem conference
 
SQL200A Microsoft Access SQL Design
SQL200A Microsoft Access SQL DesignSQL200A Microsoft Access SQL Design
SQL200A Microsoft Access SQL Design
 
Microsoft access self joins
Microsoft access self joinsMicrosoft access self joins
Microsoft access self joins
 
SQL302 Intermediate SQL
SQL302 Intermediate SQLSQL302 Intermediate SQL
SQL302 Intermediate SQL
 
AIN106 Access Reporting and Analysis
AIN106 Access Reporting and AnalysisAIN106 Access Reporting and Analysis
AIN106 Access Reporting and Analysis
 
SQL302 Intermediate SQL Workshop 3
SQL302 Intermediate SQL Workshop 3SQL302 Intermediate SQL Workshop 3
SQL302 Intermediate SQL Workshop 3
 
SQL302 Intermediate SQL Workshop 2
SQL302 Intermediate SQL Workshop 2SQL302 Intermediate SQL Workshop 2
SQL302 Intermediate SQL Workshop 2
 
Course Catalog
Course CatalogCourse Catalog
Course Catalog
 
SQL302 Intermediate SQL Workshop 1
SQL302 Intermediate SQL Workshop 1SQL302 Intermediate SQL Workshop 1
SQL302 Intermediate SQL Workshop 1
 
SQL212 Oracle SQL Manual
SQL212 Oracle SQL ManualSQL212 Oracle SQL Manual
SQL212 Oracle SQL Manual
 
SQL201W MySQL SQL Manual
SQL201W MySQL SQL ManualSQL201W MySQL SQL Manual
SQL201W MySQL SQL Manual
 
AIN100
AIN100AIN100
AIN100
 
SQL206 SQL Median
SQL206 SQL MedianSQL206 SQL Median
SQL206 SQL Median
 
SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3
SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3
SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3
 

Último

Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 

Último (20)

Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 

Introduction to coding using Python

  • 1. PYN101 – Quick Introduction to Coding Using Python www.ocdatabases.com slides.1@ocdatabases.com 949-489-1472
  • 2. Quick Introduction to coding using Python • If you have not done so already please fill out your student questionnaire online as shown or submit them to your instructor • Enjoy programming in Python!
  • 3. PYN101 Quick Introduction to Coding using Python • Introduction (s) • Facilities • Course Packet (May vary by course and class) – Student Questionnaire – Collaterals (Maps, Catalog, Etc.) – PowerPoint slide deck – Evaluation form – Training certificate
  • 4. 4
  • 5. Quick Introduction to Coding Using Python I. Introduction to Programming II. Creating Simple Programs III. Creating Programs Using Functions IV. Implementing the Object-Oriented Methodology V. Handling Programming Errors
  • 6. I. Introduction to Programming  History  Programming Environments  Overview of Programming  Introduction to the Software Development Life Cycle
  • 7. Copyright © 2011 Element K Content LLC. All rights reserved. History of Python
  • 9. Program salary1=1000 salary2=2000 sum=salary1 + salary2 print("The sum of two salaries is: {}".format(sum)) isSal2Larger = salary1 > salary2 print("Salary2 is larger than salary 1: {}".format(isSal2Larger)) serviceYears1 = 10 serviceYears2 = 5 isYears2Longer = serviceYears2 > serviceYears1 print("Salary2 is larger than salary 1 because their years of service is longer: {} ". format(isSal2Larger and isYears2Longer)) Program Interpreter Results Program written in scripting language Program written in scripting language Program displays results Program displays results Instructions (statements) written in Python Instructions (statements) written in Python
  • 10. Syntax Keyword used to create a class Keyword used to create a class Punctuation used to create a Statement block Punctuation used to create a Statement blockclass EmployeeDetails: #class methods #initialize instance variables def init (self, num, name, sal): self.empNo = num self.empName = name self.salary = float(sal) def computeAllow(self): return self.salary * 0.05 def computeNetSal(self): return self.salary - self.computeAllow() def getName(self): return self.empName Statements indented inside block Statements indented inside block
  • 11. The Programming Life Cycle Coding Executing Debugging Program containing an error Program containing an error Instructions written in a scripting language Instructions written in a scripting language Internal BytecodeInternal BytecodeSource codeSource code
  • 12. The Python Platform Process Edit Verify Load Interpret Phases in the Python platform process Phases in the Python platform process
  • 13. The Software Development Life Cycle Maintenance Testing Analysis Software Development Life Cycle Implementation Development Design
  • 14. Reflective Questions 1. Which programming methodologies do you suggest for your organization? 2. Will you follow the SDLC approach to developing software in your company? Why?
  • 15. II. Creating Simple Programs  Work with Variables  Work with Operators  Control Program Execution  Work with Lists
  • 16. Variables salary = 1750 if salary > 2500: print ("Salary is greater than 2500") else: print ("Salary is less than 2500") Variable NameVariable Name Value stored in the variable Value stored in the variable
  • 17. Operators salary1=1000 salary2=2000 sum=salary1 + salary2 print ("The sum of the two salaries is %6.2f" % sum) Expression used to calculate the sum of salaries. The result always on the left. Expression used to calculate the sum of salaries. The result always on the left. OperandOperand Data used in the expression Data used in the expression The addition operatorThe addition operator
  • 18. The if Statement salary = 1750 if salary > 2500: print("nSalary is greater than 2500") salary = salary + (0.03 * salary) Keyword used to create an if conditional statement Keyword used to create an if conditional statement Action StatementAction Statement Test conditionTest condition
  • 19. The if...else Statement salary = 1750 if salary > 2500: print("nSalary is greater than 2500") salary = salary + (0.03 * salary) else: print("nSalary is less than 2500") salary = salary + (0.05 * salary) print("Adjusted salary: {}".format(salary)) Test conditionTest condition Keyword used to create if block Keyword used to create if block Keyword used to create else block Keyword used to create else block Statements to execute when the test condition returns true Statements to execute when the test condition returns true Statements to execute when the test condition returns false Statements to execute when the test condition returns false
  • 20. The elif Statement if day == 1: print ("Monday") elif day == 2: print ("Tuesday") elif day == 3: print ("Wednesday") elif day == 4: print ("Thursday") elif day == 5: print ("Friday") elif day == 6: print ("Saturday") elif day == 7: print ("Sunday") else: print ("Invalid day value") Declared with the elif keyword Declared with the elif keyword Default statementDefault statement Repeated elif statements Repeated elif statements Test conditionTest condition
  • 21. The while Loop counter = 10 i = 1 #while loop - tests before entering the loop #make sure the loop variables are initialized print ("Basic while loop") while i <= counter: print("i = {}".format(i)) i = i + 1 Statements to execute when the test condition returns true Statements to execute when the test condition returns true Declared with the while keyword Declared with the while keyword Test conditionTest condition Note: there is no do …while … in Python
  • 22. The for Loop sum = 0 counter = 15 for i in range(1,counter+1): sum = sum + i; print("i = {}".format(sum)) Statement(s) executed while variable within sequence range Statement(s) executed while variable within sequence range Iterating variable declarationIterating variable declaration sequence expression sequence expression Declared with the for keyword Declared with the for keyword
  • 23. Lists marks = [85, 60, 78, 73, 84] 1 2 30 6085 78 73 84 4 List elementsList elements List initializationList initialization List nameList name List IndexList Index Graphical representation of list Graphical representation of list
  • 24. Multidimensional Lists salary2 =[[12000, 13000,14000], [10000,15000,2000]] tmpsalary = salary2[1][2] LIst IndexLIst Index 1300012000 14000 1500010000 20000 0100 02 1110 12 Value stored in the list element Value stored in the list element Graphical representation of a two-dimensional list Graphical representation of a two-dimensional list List elementsList elements LIst nameLIst name
  • 25. Other data structures • Tuples t=(12,15,90) • Dictionaries d={“name”:”dan”, “phone”:123-456-7890”} • Sets • And more • We will cover these in our more formal programming classes • There are also modules for manipulating datasets and big data
  • 26. Reflective Questions 1. What factors do you consider when you declare a variable? 2. How do arrays help you in your job role?
  • 27. III. Creating Programs Using Functions  Create Functions  Work with Built-in Functions
  • 28. Functions def calcNetSalary(allowance, sal): deduction = allowance/100 * sal print ("The deduction is ${:,.2f}".format(deduction)) netSal = sal - deduction return netSal Method bodyMethod body DeclarationDeclaration Method nameMethod name ParametersParameters
  • 29. Function Calls def print_salary(): #initialize variables salary = 12000.0 print("The current salary is ${:,.2f}".format(salary)) #calculate net salary by calling a function netSalary = calcNetSalary(5, salary) print("The net salary is ${:,.2f}".format(netSalary)) #function to calculate the net salary def calcNetSalary(allowance, sal): deduction = allowance/100 * sal print ("The deduction is ${:,.2f}".format(deduction)) netSal = sal - deduction return netSal Function callFunction call Function declaration Function declaration
  • 30. Importing modules import os print (os.getcwd()) print (os.listdir('.')) Import declarationImport declaration Function callsFunction calls The Python ecosystem includes a huge library of functions across many domains. This is one of Python’s strong points and is a major reason for its popularity.
  • 31. Reflective Questions 1. In what ways does importing modules help you in your job role? Discuss. 2. Why would you prefer built-in functions rather than defining your own functions? Discuss.
  • 32. IV. Implementing the Object-Oriented Methodology  Create a Class  Create an Object  Create a Constructor  Create a Subclass
  • 33. Classes class EmployeeDetails: #class methods #initialize instance variables def init (self, num, name, sal): self.empNo = num self.empName = name self.salary = float(sal) def computeAllow(self): return self.salary * 0.05 def computeNetSal(self): return self.salary - self.computeAllow() def getName(self): return self.empName Methods in the class Methods in the class Class name preceded by the class keyword Class name preceded by the class keyword Instance variables Instance variables
  • 34. Objects import employeedetails as ed #create employee object empObj = ed.EmployeeDetails() #get id and name id=int(input("Please enter employee id: ")) name=input("Please enter employee name: ") sal=input("PLease enter salary: ") #calc net salary empObj.init(id,name,sal) netSal=empObj.computeNetSal() print ("Employee details...") print ("%s with id %d has a salary of $%6.2f" % (name, id, netSal)) Object nameObject name Data stored in object empObj Data stored in object empObj Object used to store employee data Object used to store employee data data for employee data for employee Class nameClass name
  • 35. The self Keyword class EmployeeDetails: #class methods #initialize instance variables def init (self, num, name, sal): self.empNo = num self.empName = name self.salary = float(sal) def computeAllow(self): return self.salary * 0.05 def computeNetSal(self): return self.salary - self.computeAllow() def getName(self): return self.empName Class nameClass name The self keyword used to access instance variables from within a method The self keyword used to access instance variables from within a method
  • 36. Constructors class EmployeeDetails2: #class methods #constructor (initializer) with defaults def __init__(self, num=0, name='Unknown', sal=0.0): self.empNo = num self.empName = name self.salary = float(sal) def computeAllow(self): return self.salary * 0.05 def computeNetSal(self): return self.salary - self.computeAllow() def getName(self): return self.empName Class nameClass name Code to initialize the class Code to initialize the class Constructor parametersConstructor parameters ConstructorConstructor
  • 37. Objects using constructor import employeedetails2 as ed #get id and name id=int(input("Please enter employee id: ")) name=input("Please enter employee name: ") sal=input("Please enter salary: ") #create employee object using constructor empObj = ed.EmployeeDetails2(id,name,sal) #calc net salary netSal=empObj.computeNetSal() print ("Employee details...") print ("%s with id %d has a salary of $%6.2f" % (name, id, netSal)) Data stored in object empObj Data stored in object empObj Object nameObject name Class nameClass name Object nameObject name
  • 38. Subclasses from employeedetails2 import EmployeeDetails2 class ProjectMgr(EmployeeDetails2): #class methods #constructor (calls superclass) with defaults def __init__(self, num=0, name='Unknown', sal=0.0, sub=0): super().__init__(num, name, sal) self.numSubordinates = sub #override calculate net salary #replace allowance with bonus def computeNetSal(self): return self.salary + self.salary * 0.10 #new method to get nbr of subordinates def getSubordinates(self): return self.numSubordinates Keyword used to call superclass Keyword used to call superclass SubclassSubclass Parent (super) class Parent (super) class Default values for constructor Default values for constructor overidden methodoveridden method New method extends functionality New method extends functionality
  • 39. Instantiate subclass import projectmgr as pm #get id and name id=int(input("Please enter employee id: ")) if id != 0: name=input("Please enter employee name: ") sal=input("Please enter salary: ") subs=int(input("Please enter # subordinates: ")) #create employee object pmObj = pm.ProjectMgr(id, name, sal, subs) else: pmObj = pm.ProjectMgr() #calc net salary print ("Employee details...") print ("%s with id %d has a salary of $%6.2f" % (pmObj.getName(), id, pmObj.computeNetSal())) print ("%s with id %d has a %d subordinates" % (pmObj.getName(), id, pmObj.getSubordinates())) Create pm object with arguments Create pm object with arguments Get values for constructor Get values for constructor Crate default pm object Crate default pm object Call methods,; note getName is in Call methods,; note getName is in
  • 40. Reflective Questions 1. Discuss the advantages of using objects in your program. 2. In what ways does method overloading and overriding help you as you create software in your job role?
  • 41. Quick introduction to coding using Python • Please fill out your evaluations online as shown or submit them to your instructor • Enjoy programming in Python!

Notas do Editor

  1. The red arrow points to the training center. The yellow sunburst is the intersection of the Ortega Highway and Interstate 5, the route by which most students will reach the us.
  2. OV #: Source File Name(s): Figure File Name: Comments:
  3. OV #: Source File Name(s): Figure File Name: Comments:
  4. OV #: Source File Name(s): Figure File Name: Comments:
  5. OV #: Source File Name(s): Figure File Name: Comments:
  6. OV #: Source File Name(s): Figure File Name: Comments:
  7. OV #: Source File Name(s): Figure File Name: Comments:
  8. OV #: Source File Name(s): Figure File Name: Comments:
  9. OV #: Source File Name(s): Figure File Name: Comments:
  10. OV #: Source File Name(s): Figure File Name: Comments: