You are currently viewing What are reserved words in Python

What are reserved words in Python

There are some reserved words in Python, you cannot use them as a variable or constant. If it is being used as the class name, variable name, constant of function name it will throw an error. So avoid using these keywords.

Why avoid these keywords?

These keywords are interpreted by Python differently, these keywords are used to perform certain tasks or activities.

List of reserved words in Python

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

Leave a Reply