0 votes
22 views

1 Answer

0 votes
by (user.guest)
 
Best answer

Python like most programming languages have a set of words that are reserved and as such cannot be used as variable names or any other identifiers. All keywords except True, False and None are in lowercase and must be written as they are. It is worth remembering that python is a case-sensitive language.

These keywords are as listed below:

  • and - A logical operator
  • as - To create an alias
  • assert - For debugging
  • break - To break out of a loop
  • class - To define a class
  • continue - To continue to the next iteration of a loop
  • def - To define a function
  • del - To delete an object
  • elif - Used in conditional statements, same as else if
  • else - Used in conditional statements
  • except - Used with exceptions, what to do when an exception occurs
  • False - Boolean value, result of comparison operations
  • finally - Used with exceptions, a block of code that will be executed no matter if there is an exception or not
  • for - To create a for loop
  • from -  To import specific parts of a module
  • global - To declare a global variable
  • if - To make a conditional statement
  • import - To import a module
  • in - To check if a value is present in a list, tuple, etc.
  • is - To test if two variables are equal
  • lambda - To create an anonymous function
  • None - Represents a null value
  • nonlocal - To declare a non-local variable
  • not - A logical operator
  • or - A Logical operator
  • pass - A null statement, a statement that will do nothing
  • raise - To raise an exception
  • return - To exit a function and return a value
  • True - Boolean value, result of comparison operations
  • try - To make a try...except statement
  • while - To create a while loop
  • with - Used to simplify exception handling
  • yield - To end a function, returns a generator

Please leave a comment below and share with other students in your network if you found this answer helpful. Happy learning!

Related questions

Welcome to CPEN Talk
Solution-oriented students of computer engineering on one platform to get you that

ONE SOLUTION

...