top of page
Writer's pictureRajesh Singh

What is a Python Keyword?

Updated: May 18, 2020


A python keyword is a known as reserve word which can’t use as a name of your variable, class, function etc. These keywords have a particular meaning and they are used for particular purposes in Python programming language. For example – Python keyword “for” is used for “for loop” so we can’t name a variable with the name “for” else it may cause compilation error. There are total 33 keywords in Python 3.6.


Python keywords

False def if raise

None del import return

True elif in try

and else is while

as except lambda with

assert finally nonlocal yield

break for not

class from or

continue global pass

Example of Python keyword

Using while keyword to create a loop for displaying the values of variables num greater than 6.


num = 10 while num>6: print(num) num -= 1


Output:

10 9 8 7


6 views0 comments

Recent Posts

See All

Comentarios


bottom of page