A name used to store data that can change during the program.
Variable
Name three basic data types in Python.
int, float, str
What does the + operator do?
Adds two values.
What does IPO stand for in programming?
Input, Process, Output
What keyword starts a decision in Python?
if
How do you assign the value 10 to a variable called x?
x = 10
What data type is the result of 5.0 + 2?
float
What is the result of 3 + 4 * 2?
11 (multiplication before addition)
What Python function is commonly used for input?
input()
What will this print? if 3 > 2: print("Yes")
Yes
What keyword is commonly used to define a constant in Python, even though Python doesn't enforce it?
Constants are written in all caps, e.g., PI = 3.14.
Is my-variable a valid variable name in Python?
No, hyphens/dash are not allowed. Use underscores instead.
What is the result of 10 // 3?
3 (floor division)
What is the output of: print(5 * 2 + 1)?
11
What is the role of else in an if statement?
Runs code if the condition is false.
Is the following valid? 3x = 5 Why or why not?
No, variable names cannot start with a number.
Name two Python naming conventions for variables.
Use lowercase letters, use underscores for readability (snake_case).
What does % operator do in Python?
Returns the remainder of a division.
Identify the process in this code:
total = price * quantity
price * quantity is the process (calculation).
What is the difference between = and == in an if statement?
= is for assignment, == is for comparison (equality check).
Explain the difference between a variable and a constant.
A variable can change during execution; a constant should remain unchanged throughout the program.
What is this case called? variableOne
camelCase
Evaluate: (5 + 3) * 2 ** 2
32
Write a Python expression to read/enter a name and print a welcome message.
name = input("Enter name: ")
print("Welcome, " + name)
What will be printed? x = 5; if x > 10: print("High"); else: print("Low")
Low