They are special words that cannot be used as identifiers.
2
New cards
How many python reserved keywords are there?
35
3
New cards
What are the 35 python keywords
False, None, True, and, as, assert, async, await, break, class, continue, def, del, elif, else, except, finally, for, from, global, if, import, in, is, lambda, nonlocal, not, or, pass, raise, return, try, while, with, yield.
4
New cards
What is the "False" keyword?
A boolean value, the result of a false comparison.
5
New cards
What is the "None" keyword?
A data type used to define a null value, or no value at all.
6
New cards
What is the "True" keyword?
A boolean value, the result of a true comparison.
7
New cards
What is the "and" keyword?
A logical operator used to combine two statements.
8
New cards
What is the "as" keyword?
A keyword used to create an alias.
9
New cards
What is the "assert" keyword?
A keyword used when debugging code that allows you to test if a condition is true, and allows you to write a message if the code is false.
10
New cards
What is the "async" keyword?
A keyword used to define asynchronous functions
11
New cards
What is the "await" keyword?
A keyword used in asynchronous programming that allows a function to pause its execution until an asynchronous operation is complete.
12
New cards
What is the "break" keyword?
A keyword used to break out of a for loop or a while loop.
13
New cards
What is the "class" keyword?
A keyword used to create a class.
14
New cards
What is the "continue" keyword?
A keyword used to end a current iteration for a loop and continue to the next iteration.
15
New cards
What is the "def" keyword?
A keyword used to create or define a function
16
New cards
What is the "del" keyword?
A keyword used to delete objects such as classes, functions, lists, and variables.
17
New cards
What is the "elif" keyword?
A keyword used in conditional statements short for else if.
18
New cards
What is the "else" keyword?
A keyword used in conditional statements which decides what to do if the condition is false.
19
New cards
What is the "except" keyword?
A keyword used in try and except blocks which defines a block of code to run if the try block raises an error.
20
New cards
What is the "finally" keyword?
A keyword used in try and except blocks that defines a block of code to run when the try and except block is finished, regardless if there was or wasn't an error.
21
New cards
What is the "for" keyword?
A keyword used to create a for loop.
22
New cards
What is the "from" keyword?
A keyword used to import only a specified portion of a module.
23
New cards
What is the "global " keyword?
A keyword used to create global variables from a non-global scope (inside a function)
24
New cards
What is the "if" keyword?
A keyword used to create conditional statements that allows you to execute a block of code only if a condition is true.
25
New cards
What is the "import" keyword?
A keyword used to import a module
26
New cards
What is the "in" keyword?
A keyword that when used with the if statement can check for a value in a sequence (list, str, dic, tup). When used with a for keyword can iterate through each value in a list.
27
New cards
What is the "is" keyword?
A keyword used to test if two variables refer to the same object. It returns a value of True or False.
28
New cards
What is the "lambda" keyword?
A keyword used to create small anonymous functions. It can take any number of arguments, but only one expression.
29
New cards
What is the "nonlocal" keyword?
A keyword is used to work with variables inside nested functions, where the variable should not belong to the inner function..
30
New cards
What is the "not" keyword?
A keyword that's operates as a logical operator. It returns the value of True if the statements aren't true and it returns a value of False if the statement is true.
31
New cards
What is the "or" keyword?
A keyword that is a logical operator that combines conditional statements, which returns a value of True when one of the statements are true or False when none of the statements are true.
32
New cards
What is the "pass" keyword?
A keyword that acts as a statement which is used as a placeholder for future code. When it's used nothing happens, but you avoid getting an error when empty code isn't allowed.
33
New cards
What is the "raise" keyword?
A keyword used to raise an exception.
34
New cards
What is the "return" keyword?
A keyword used to exit a function and return a value.
35
New cards
What is the "try" keyword?
A keyword used in try and except blocks that defines a a block of code
36
New cards
What is the "while" keyword?
A keyword used to create a while loop.
37
New cards
What is the "with" keyword?
A keyword used to simplify exception handling.
38
New cards
What is the "yield" keyword?
A keyword used to return a list of values from a function.