Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views16 pages

UNIT 2 LESSON4 Compressed

The document outlines the distinction between keywords and identifiers in Python programming. Keywords are reserved words that define the syntax and structure, while identifiers are names given to entities like classes and functions. It also provides rules for using identifiers, including naming conventions and restrictions on starting characters and special symbols.

Uploaded by

Brieanne Boreroz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views16 pages

UNIT 2 LESSON4 Compressed

The document outlines the distinction between keywords and identifiers in Python programming. Keywords are reserved words that define the syntax and structure, while identifiers are names given to entities like classes and functions. It also provides rules for using identifiers, including naming conventions and restrictions on starting characters and special symbols.

Uploaded by

Brieanne Boreroz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

DISTINGUISHING

KEYWORDS FROM
IDENTIFIERS
LESSON 3
1 2 3
Define See the list of Define
keywords in keywords used identifiers in
Python in Python Python
4 5
Enumerate the Accept the
rules in using nature of
identifiers reserved words
used in Python.
Keywords
Keywords are the
reserved words in
Python. They are
used to define the
syntax and
structure in Python.
Keywords in Python
False class finally is return

None continue for lambda try

True def from nonlocal while

and del global not with

as elif if or yield

assert else import pass

break except in raise


Identifiers
Identifiers are the names given to
entities like classes, functions,
variables, etc.
Variables
Is a name that
holds a value. It
can store
different types of
data like
numbers, strings,
lists and etc.
Function
(Reusable Code)
A Function is a
block of reusable
code that
performs a
specific task.
Classes (Blueprint
for Objects)
A class is
template for
creating objects
with attributes
and methods.
1. It can be combination of:
a. lettes in lowercase (a - z),
b. letters in uppercase (A - Z)
c. digits (0 - 9), or
d. underscore (_).
2. It cannot start with digit.
1variable is invalid, but
variable1 is perfectly fine.
INVALID

1variable = 10 # SyntaxError: invalid syntax

123var = "Hi" # Invalid because it starts with a digit
VALID variable1 = 10
_variable = "Hello"
var123 = 5.5
3. It cannot use keywords
4. It cannot use special
symbols like !, @, #, $, %.
5. It can be of any length.
Do’s in Python
2
1 3
Multiple words can
be separated using
Python is a an underscore or Variables should
have names that
case-senstive camel case style of
are close or related
language. writing.
to the value they
hold or represent.
Thank You
ACTIVITY 1:
ELIMINATE INVALID IDENTIFIERS

Alpha sum 2form

x-value #total firstName

y8 #result globalvariable

if while value_@_ten

username Password go
ACTIVITY 2:
RENAME THE VARIABLES
Variable Underscore CamelCase

Total Sale

Area of a Square

Sum of 7 Entries

Average Scores

Total Orders

You might also like