Python Programming Basics
- 35Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
35 questions
- 1To check the installed Python version, you type_____in the command prompt.
Hint
You need to use the word 'python' followed by a double dash and the word 'version'.
Answer
python --version
- 2The file extension for Python source code files is_____.
Hint
Think about the common abbreviation for Python.
Answer
.py
- 3In Python, the function that outputs text to the screen is called_____.
Hint
Think about what you use to display something.
Answer
print
- 4To exit the Python interactive shell, you can type_____.
Hint
It's a function that closes the session.
Answer
exit()
- 5An IDE is an integrated development environment, and a popular free one for Python is_____.
Hint
It's made by Microsoft and is very popular for coding.
Answer
Visual Studio Code
- 6The operator for floor division in Python is_____.
Hint
It's two forward slashes, used to get integer division without remainder.
Answer
//
- 7The operator that returns the remainder of division is_____.
Hint
It's also called the modulus operator.
Answer
%
- 8The operator for exponentiation in Python is_____.
Hint
It's two asterisks, used to raise a number to a power.
Answer
**
- 9Python follows the acronym_____for order of operations.
Hint
It stands for Parentheses, Exponents, Multiplication, Division, Addition, Subtraction.
Answer
PEMDAS
- 10Strings in Python can be enclosed in either double or_____quotes.
Hint
It's the other common quote type besides double.
Answer
single
- 11To include a single quote inside a single-quoted string, you should enclose the string in_____quotes instead.
Hint
Use the opposite type of quotes to avoid syntax errors.
Answer
double
- 12In Python, comments start with the_____symbol.
Hint
It's also called the hash or pound symbol.
Answer
- 13Variable names in Python can contain letters, numbers, and_____, but cannot start with a number.
Hint
It's a punctuation character that looks like a line.
Answer
underscores
- 14Python variable names are case-_____, meaning 'Age' and 'age' are different variables.
Hint
This means uppercase and lowercase letters are distinguished.
Answer
sensitive
- 15The operator used to assign a value to a variable is_____.
Hint
It's a single equals sign.
Answer
=
- 16Python is_____typed, meaning you don't have to declare the data type of a variable.
Hint
The type is inferred at runtime, not at compile time.
Answer
dynamically
- 17The function used to get user input in Python is_____.
Hint
It's a built-in function that reads a line from the user.
Answer
input
- 18To delete a variable in Python, you use the_____keyword.
Hint
It's short for 'delete'.
Answer
del
- 19The comparison operator for 'equal to' in Python is_____.
Hint
It's two equals signs, not one.
Answer
==
- 20In an if statement, the condition is followed by a_____to indicate the start of the code block.
Hint
It's a punctuation mark used in many Python structures.
Answer
colon
- 21The keyword_____is used to add an alternative condition after an if statement.
Hint
It's a combination of 'else' and 'if'.
Answer
elif
- 22The keyword_____provides a fallback block when no previous condition is true.
Hint
It's the last option in a conditional chain.
Answer
else
- 23Functions are defined using the_____keyword.
Hint
It's short for 'define'.
Answer
def
- 24Values passed into a function when calling it are called_____.
Hint
Also known as 'parameters'.
Answer
arguments
- 25To send a value back from a function, you use the_____statement.
Hint
It exits the function and optionally passes a value back to the caller.
Answer
return
- 26A function must be_____before it can be called in your code.
Hint
The definition must appear earlier in the file than the call.
Answer
defined
- 27A while loop continues executing as long as its_____is true.
Hint
It's a boolean expression evaluated each iteration.
Answer
condition
- 28To prevent an infinite loop, the variable in the condition should be_____inside the loop.
Hint
You need to change its value so the condition eventually becomes false.
Answer
incremented
- 29The for loop is often used with the_____function to generate a sequence of numbers.
Hint
It creates a range object that generates numbers.
Answer
range
- 30The_____statement immediately exits a loop.
Hint
It 'breaks' out of the loop entirely.
Answer
break
- 31The_____statement skips the rest of the current iteration and moves to the next one.
Hint
It 'continues' with the next cycle of the loop.
Answer
continue
- 32To use the math library, you write_____math at the top of your script.
Hint
It's the keyword to bring in external modules.
Answer
import
- 33A_____error occurs when code violates the grammatical rules of Python.
Hint
It's like a spelling or grammar mistake in code.
Answer
syntax
- 34A_____error occurs during program execution, like dividing by zero.
Hint
It happens 'at runtime' while the program is running.
Answer
runtime
- 35A_____error means the program runs but produces incorrect results due to flawed logic.
Hint
It's related to meaning, not syntax.
Answer
semantic

Ask anything
We've read this whole study set, so questions about it get the best answers.