Python Keywords

« Previous Tutorial Next Tutorial »

Keywords are reserved words, having their special meaning in python. You can not use any of the python keyword as identifier. Keywords in python used to perform some particular task.

List of Keywords in Python

Here, the following table lists keywords available in Python programming:

and or from def try
is exec break print if
elif with not for global
return in except assert pass
raise del while lambda finally
class continue import else yield


Here is an example in python uses some python keywords listed in the above table:

while True:
	print("Enter 'x' for exit.")
	name = input("Enter your name: ")
	ntime = int(input("How many time you want to print your name ? "))
	if name == 'x':
		for i in range(0, ntime):

Here is the sample run of the above python program illustrating the use of keywords in a python program:

python keywords

As you can see from the above snapshot, all the word in red color are keywords of python language. Here are the list of keywords that are used in the above program:

More Examples

Here are list of some more examples, uses some keywords of python language:

« Previous Tutorial Next Tutorial »

Latest 5 Posts by CodesCracker


Quick Links
Signup - Login - Give Online Test