Startertutorials Blog
Tutorials and articles related to programming, computer science, technology and others.
Subscribe to Startertutorials.com's YouTube channel for different tutorial and lecture videos.

Categories: Python Programming. No Comments on Python Keywords List
1
(1)

In this article we will learn about the Python keywords. First we will see a list of Python Keywords followed by the description of each keyword.

 

Following are keywords available in Python:

 

andasassertbreakclass
continuedefdelelifelse
exceptfinallyforfromFalse
globalifimportinis
lambdaNonenonlocalnotor
passraisereturntryTrue
whilewith yield

 

Now, let’s look at the description of each keyword:

 

False – False boolean value


Subscribe to our monthly newsletter. Get notified about latest articles, offers and contests.


 

True – True boolean value

 

None – Special constant in Python that represents nothing or a null value

 

and – Logical and operator

 

as – Used to create an alias while importing a module

 

assert – Assert is used to create assertions which are used for debugging

 

break – Used inside loops to alter its behaviour

 

class – Used to define a new user-defined class

 

continue – Used inside loops to alter its behaviour

 

def – Used to define a used-defined function

 

del – Used to delete the reference to an object

 

elif – Else if ladder

 

else – Used in conjunction with if

 

except – Used in exception handling

 

finally – Used in exception handling

 

for – Is a loop to repeat a set of statements

 

from – Used to import specific attributes or functions into the current namespace

 

global – Used to declare a variable inside a function (local variable) as global variable

 

if – One-way selection statement

 

import – Used to import modules into the current namespace

 

in – Used to test if a sequence (string, list, tuple, etc.) contains a value. Also used in a for loop to traverse over a range of values.

 

is – Used to test object identity (whether two variables are referring to same object or not)

 

lambda – Used to create an anonymous (nameless) function

 

nonlocal – Used inside nested functions to say that the variable is modifiable outside the function in which it is being used

 

not – Logical not operator

 

or – Logical or operator

 

pass – Pass is a null statement in Python. Nothing happens when it is executed.

 

raise – Used in exception handling

 

return – Used inside a function to exit it and return a value

 

try – Used in exception handling

 

while – Is a loop to repeat a set of statements

 

with – with statement is used to wrap the execution of a block of code within methods defined by the context manager

 

yield – yield is used inside a function like a return statement. But yield returns a generator.

 

Learn more about the Python keywords and examples using the following resources:

How useful was this post?

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Suryateja Pericherla

Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.

He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.

He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.

Leave a Reply

Your email address will not be published. Required fields are marked *