16. try : This keyword is used for exception handling, used to catch the errors in the code using the keyword except. Code in “try” block is checked, if there is any type of error, except block is executed.
17. except : As explained above, this works together with “try” to catch exceptions.
18. raise : Also used for exception handling to explicitly raise exceptions.
19. finally : No matter what is result of the “try” block, block termed “finally” is always executed. Detailed article –Exception Handling in Python
20. for : This keyword is used to control flow and for looping.
21. while : Has a similar working like “for” , used to control flow and for looping.
22. pass : It is the null statement in python. Nothing happens when this is encountered. This is used to prevent indentation errors and used as a placeholder
Detailed Article – for, while, pass
23. import : This statement is used to include a particular module into current program.
24. from : Generally used with import, from is used to import particular functionality from the module imported.
25. as : This keyword is used to create the alias for the module imported. i.e giving a new name to the imported module.. E.g import math as mymath.
Detailed Article – import, from and as
26. lambda : This keyword is used to make inline returning functions with no statements allowed internally. Detailed Article – map, filter, lambda
27. return : This keyword is used to return from the function. Detailed article – Return values in Python.
28. yield : This keyword is used like return statement but is used to return a generator. Detailed Article – yield keyword
29. with : This keyword is used to wrap the execution of block of code within methods defined by context manager.This keyword is not used much in day to day programming.
30. in : This keyword is used to check if a container contains a value. This keyword is also used to loop through the container.
31. is : This keyword is used to test object identity, i.e to check if both the objects take same memory location or not.
s is part of geeksforgeeks g e e k s f o r g e e k s True False
32. global : This keyword is used to define a variable inside the function to be of a global scope.
33. non-local : This keyword works similar to the global, but rather than global, this keyword declares a variable to point to variable of outside enclosing function, in case of nested functions.
10 5 5 Value of a using nonlocal is : 10 Value of a without using nonlocal is : 5
This article is contributed by Manjeet Singh(S. Nandini). If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Python | Set 4 (Dictionary, Keywords in Python)
- Keywords in Python | Set 1
- Python program to extract Keywords from a list
- Pafy - Getting Keywords for each item of Playlist
- Operator Functions in Python | Set 2
- Time Functions in Python | Set-2 (Date Manipulations)
- Generate all permutation of a set in Python
- Interesting facts about strings in Python | Set 1
- Interesting facts about strings in Python | Set 2 (Slicing)
- Creating a Proxy Webserver in Python | Set 1
- Function Decorators in Python | Set 1 (Introduction)
- Creating a Proxy Webserver in Python | Set 2
- Object Oriented Programming in Python | Set 1 (Class, Object and Members)
- Object Oriented Programming in Python | Set 2 (Data Hiding and Object Printing)
- Regular Expressions in Python | Set 2 (Search, Match and Find All)
- Python String Methods | Set 1 (find, rfind, startwith, endwith, islower, isupper, lower, upper, swapcase & title)
- Python String Methods | Set 2 (len, count, center, ljust, rjust, isalpha, isalnum, isspace & join)
- Python String Methods | Set 3 (strip, lstrip, rstrip, min, max, maketrans, translate, replace & expandtabs())
- Counters in Python | Set 1 (Initialization and Updation)
- OOP in Python | Set 3 (Inheritance, examples of object, issubclass and super)