Tuesday 2 July 2019

Reserved word or Keyword

Definition:
At the time of designing program languages, some words are reserved to do specific tasks. Such words are called keyword/Reserved word/Predefined word

There are 33 keywords are available in python.

True,False,None
and, or,not,is
if,elif,else
while,for,break,continue,return,in,
yield
try,except,finally,raise,assert,
import,from,as,class,def,pass,global,nonlocal,lambda,del,with

Note: all the reserved words in python are lower case letters except True,False,None.

To see the keyword, you need to type the following commands in the Python prompt

>>> import keyword (Press enter)
>>> keyword.kwlist (Press enter)
['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda' ', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
>>> 




Previous topic: Python identifier
Next Topic: Variable

You may like the following posts:
Reserved word
Other tutorials


No comments:

Post a Comment

Files with Exception handling

#Ask the user to take two input integer values var a,b try:     a=int(input("enter any integer value:"))     b=int(input(&qu...