List of All 35 Reserved Keywords in Python Programming Language 3.11


35 Reserved Keywords in Python

There are in all 35 reserved words called as keywords in Python Programming Language.

  1. False
  2. True
  3. None
  4. await
  5. and
  6. as
  7. assert
  8. async
  9. class
  10. continue
  11. def
  12. del
  13. else
  14. elif
  15. except
  16. finally
  17. for
  18. from
  19. import
  20. pass
  21. break
  22. if
  23. in
  24. is
  25. lambda
  26. global
  27. or
  28. raise
  29. return
  30. try
  31. nonlocal
  32. while
  33. not
  34. with
  35. yield


Note: Reserved keywords cannot be used as identifiers and you should spell them exactly the same or else they may not work and you will get syntax errors!

Example:
#keyword is False and not lowercase false
my_bool = false 

if(my_bool is False):
  print("It is False")
Output:

NameError: name 'false' is not defined


Soft Keywords (introduced in 3.10)

Soft keywords are identified that are reserved only in certain contexts like pattern-matching.

  1. match
  2. case
  3. _


















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap