Assignment
Python VariablesStoring a value inside a named variable using the single equals sign (=) or a compound operator like +=.
score = 100Python Dictionary
Clear, plain-English definitions and small code examples for every core term used across the nine chapters.
Storing a value inside a named variable using the single equals sign (=) or a compound operator like +=.
score = 100An operator (&, |, ^, ~, <<, >>) that works directly on the binary 0 and 1 bits of integer values.
print(6 & 3) # 2A data type with only two possible values: True or False (always capitalized in Python).
is_ready = TrueExplicitly converting a value from one data type to another using functions such as int(), float(), str(), or bool().
age = int("16")Human-readable note starting with # that Python completely ignores when running the program.
# Explain why this line existsprint("Hi")A numeric type in Python written with a real part and an imaginary part marked by j.
z = 2 + 3jThe category of a value that determines what operations are valid on it, such as str, int, float, or bool.
print(type("Hello"))A comparison operator that returns True when two values are equal and False otherwise.
print(5 == 5) # TrueA formatted string prefixed with f that allows embedding variables and expressions inside curly braces {}.
name = "Leo"print(f"Hi, {name}!")A number containing a decimal point or written in scientific notation (e.g., 3.14 or 2.5e3).
pi = 3.14An arithmetic operator that divides two numbers and rounds down to the nearest whole integer.
print(17 // 5) # 3A variable created outside any function so it can be read throughout the program.
course = "Python"An operator (is, is not) checking whether two variables refer to the exact same object in memory.
x = Noneprint(x is None)Spaces at the start of a line (4 spaces by convention) used by Python to group statements inside blocks.
if 5 > 2: print("Yes")The integer position of a character in a string (or item in a sequence), starting from 0 for the first item.
word = "Python"print(word[0]) # PA whole number—positive, negative, or zero—with no decimal point.
count = -42A built-in function that returns the number of characters in a string or items in a sequence.
print(len("Python")) # 6A variable created inside a function that can only be accessed within that function.
def greet(): msg = "Hello" print(msg)Keywords (and, or, not) that combine or reverse boolean conditions.
print(True and not False)Keywords (in, not in) that check whether a substring or element exists inside a sequence.
print("Py" in "Python")An arithmetic operator that returns the remainder left over after dividing two numbers.
print(17 % 5) # 2Python's built-in output function for displaying text and numbers on screen, supporting sep and end options.
print("A", "B", sep="-")An ordered sequence of characters enclosed in single, double, or triple quotation marks.
title = "Python Basics"The grammar rules of a programming language governing spelling, quotes, parentheses, and indentation.
print("Valid syntax")A built-in Python function that tells you the data type of any value or variable.
print(type(3.5)) # <class 'float'>A named location used to store a value in a Python program so it can be reused or changed later.
name = "Python"