D522 Practice Question with Verified Correct
Answers
Python syntax
The rules for writing Python code correctly.
Python comments
Notes in code that Python ignores; written with #.
Whitespace
Spaces or blank areas in code; indentation matters in Python.
Indentation
The spaces before code that show what belongs inside a block.
Block
A group of indented code that belongs together.
Scope
Where a variable can be used in a program.
print()
A built-in function that displays output on the screen.
input()
A built-in function that gets information from the user.
Built-in function
A function Python already provides, like print(), len(), type(), or range().
, Variable
A named storage spot for a value.
Assignment
Storing a value in a variable using =.
Multiple variables
Assigning values to more than one variable.
Variable scope
The area of the code where a variable exists and can be used.
Data type
The kind of value stored, such as int, float, string, or Boolean.
int
A whole number with no decimal.
float
A number with a decimal.
string
Text surrounded by quotes.
Boolean
A value that is either True or False.
String slicing
Getting part of a string using indexes.
Answers
Python syntax
The rules for writing Python code correctly.
Python comments
Notes in code that Python ignores; written with #.
Whitespace
Spaces or blank areas in code; indentation matters in Python.
Indentation
The spaces before code that show what belongs inside a block.
Block
A group of indented code that belongs together.
Scope
Where a variable can be used in a program.
print()
A built-in function that displays output on the screen.
input()
A built-in function that gets information from the user.
Built-in function
A function Python already provides, like print(), len(), type(), or range().
, Variable
A named storage spot for a value.
Assignment
Storing a value in a variable using =.
Multiple variables
Assigning values to more than one variable.
Variable scope
The area of the code where a variable exists and can be used.
Data type
The kind of value stored, such as int, float, string, or Boolean.
int
A whole number with no decimal.
float
A number with a decimal.
string
Text surrounded by quotes.
Boolean
A value that is either True or False.
String slicing
Getting part of a string using indexes.