1. Python Basic Keywords Flashcards
What does “False” do?
Boolean value representing false.
(Boolean value = value that is true or false)
What does “None” do?
Represents the absence of a value.
What does “True” do?
Boolean value representing true.
What does “and” do?
The ‘and’ checks if BOTH things are True.
Logical AND operator.
# Let’s say you’re checking if you’re allowed to go to a party.
# You need to be on the guest list AND you need to bring a ticket.
on_guest_list = True # You ARE on the guest list
has_ticket = True # You DO have a ticket
if on_guest_list and has_ticket:
print(“You can enter the party!”)
What does “as” do?
Used to create an alias, especially in imports.
What does “assert” do?
Used for debugging; tests if a condition is true.
What does “async” do?
Declares an asynchronous function.
What does “await” do?
Waits for completion of an async function.
What does “break” do?
Exits the nearest enclosing loop.
What does “class” do?
Used to define a class.
What does “continue” do?
Skips the rest of the loop and starts next iteration.
What does “def” do?
Used to define a function.
What does “del” do?
Deletes a reference to an object.
What does “elif” do?
Else if condition in an if statement.
What does “else” do?
Default block when if/elif conditions are false.
What does “except” do?
Handles exceptions in try-except blocks.
What does “finally” do?
Block that always executes after try-except.
What does “for” do?
Starts a for loop.
What does “from” do?
Used with import to specify the module.
What does “global” do?
Declares a global variable.
What does “if” do?
Starts a conditional block.
What does “import” do?
Imports a module.
What does “in” do?
Checks membership or used in for loops.
What does “is” do?
Tests object identity.