LivingBots
Learning Lab: Python Lists

Learning LabsCoding Lab

Story Driven Python Skills
MODULE 1
Module Progress
Alpha's Python Mission
Module 1 – List Basics & Sorting
Question 1 of 20
Correct: 0 · Attempts: 0
Alpha flying bot
Alpha floats beside you. Get a question right and he rockets up, flips, and dives back in.
Total Score (this module)
0
Current Question Time
0.0 s
Streak
0 in a row (best 0)
Average Time
Questions Done
0 / 20
Module
Module 1 – List Basics & Sorting: 0 / 20
Last result:

Flip-Cards – Python Exam Vocab

Tap a card to flip; tap the checkmark to mark it mastered.

strptime
Converts a string into a date object (parse).
strftime
Formats a date/time object as a string.
%Y
Four-digit year in strftime/strptime.
%m
Two-digit month in strftime/strptime.
%d
Two-digit day in strftime/strptime.
%H
Two-digit hour (24-hour) in strftime/strptime.
%M
Two-digit minute in strftime/strptime.
%S
Two-digit second in strftime/strptime.
datetime module
Provides classes for manipulating dates and times.
timedelta
Represents the difference between two dates or times.
io module
Read from and write to files or in-memory streams.
sys module
Access system info like argv and stderr.
os module
Work with the operating system (files, folders, env vars).
math module
Mathematical functions like sqrt, sin, cos, pi.
random module
Generate random numbers, shuffle lists, make random choices.
json module
Encode and decode JSON data.
re module
Regular expression operations for pattern matching.
collections module
Specialized container datatypes like Counter, deque.
f-string
Formatted string: print(f"Hello {name}")
str.split()
Splits a string into a list of substrings.
str.join()
Joins list elements into a single string with separator.
str.strip()
Removes leading and trailing whitespace.
str.replace()
Returns a copy with all occurrences of old replaced by new.
str.find()
Returns index of first occurrence or -1 if not found.
str.upper()
Returns uppercase copy of the string.
str.lower()
Returns lowercase copy of the string.
str.startswith()
Returns True if string starts with the given prefix.
str.endswith()
Returns True if string ends with the given suffix.
str.format()
Formats string with placeholders replaced by arguments.
\n
Escape sequence for a newline.
\t
Escape sequence for a tab.
\\
Escape sequence for a literal backslash.
\"
Escape sequence for a double quote inside a string.
logic (semantic) error
Program runs but behaves incorrectly.
syntax error
Code has a typo/structure error and will not run.
runtime error
Error that appears when a specific line executes.
TypeError
Raised when an operation is applied to wrong type.
ValueError
Raised when a function gets argument of right type but wrong value.
IndexError
Raised when a sequence subscript is out of range.
KeyError
Raised when a dictionary key is not found.
AttributeError
Raised when an attribute reference or assignment fails.
NameError
Raised when a local or global name is not found.
ZeroDivisionError
Raised when dividing by zero.
FileNotFoundError
Raised when trying to open a file that doesn't exist.
raise
Immediately throws an exception (shows an error).
try
Block where you test code for errors.
except
Block that handles an error from try.
finally
Runs whether or not an error happened.
else (try)
Block that runs if no exception was raised in try.
assert
Tests a condition; raises AssertionError if false.
[::2]
Slice that takes every other item in a list.
list.append(x)
Adds x to the end of the list; changes the list in place.
list.sort()
Sorts the list in place, default ascending order.
list.pop()
Removes and returns the last item (or item at index).
list.insert(i, x)
Inserts x at position i in the list.
list.remove(x)
Removes first occurrence of x from the list.
list.index(x)
Returns index of first occurrence of x.
list.count(x)
Returns number of times x appears in the list.
list.reverse()
Reverses the list in place.
list.extend()
Adds all items from another iterable to the list.
list.copy()
Returns a shallow copy of the list.
list.clear()
Removes all items from the list.
sorted()
Returns a new sorted list from any iterable.
len()
Returns the number of items in a sequence or collection.
range()
Generates a sequence of integers, often used in for-loops.
print()
Outputs text to the console.
input()
Reads a line of text from the user.
type()
Returns the type of an object.
int()
Converts a value to an integer.
float()
Converts a value to a floating-point number.
str()
Converts a value to a string.
bool()
Converts a value to a boolean.
list()
Creates a list from an iterable.
dict()
Creates a dictionary.
set()
Creates a set (unordered, unique items).
tuple()
Creates an immutable ordered sequence.
max()
Returns the largest item in an iterable.
min()
Returns the smallest item in an iterable.
sum()
Returns the sum of all items in an iterable.
abs()
Returns the absolute value of a number.
round()
Rounds a number to a given precision.
enumerate()
Returns index-value pairs from an iterable.
zip()
Combines multiple iterables into tuples.
map()
Applies a function to every item in an iterable.
filter()
Filters items based on a function returning True/False.
open()
Opens a file and returns a file object.
for loop
Iterates over items in a sequence or other iterable.
while loop
Repeats a block while a condition remains True.
break keyword
Immediately exits the nearest enclosing loop.
continue keyword
Skips to the next loop iteration.
pass
Does nothing; placeholder for empty code blocks.
if
Executes a block if a condition is True.
elif
Checks another condition if previous if/elif was False.
else
Executes if all previous if/elif conditions were False.
def
Keyword to define a new function.
return
Ends a function and optionally sends a value back.
lambda
Creates a small anonymous function.
*args
Collects extra positional arguments into a tuple.
**kwargs
Collects extra keyword arguments into a dictionary.
global
Declares a variable as global inside a function.
nonlocal
Refers to a variable in the enclosing (non-global) scope.
import
Loads a module so its code can be used.
from...import
Imports specific items from a module.
as (import)
Creates an alias for an imported module or item.
__name__
Special variable; equals '__main__' when script runs directly.
int
Integer data type (whole numbers).
float
Floating-point data type (decimal numbers).
str
String data type (text).
bool
Boolean data type (True or False).
None
Represents the absence of a value.
list
Mutable ordered sequence of items.
tuple
Immutable ordered sequence of items.
dict
Mutable mapping of key-value pairs.
set
Mutable unordered collection of unique items.
==
Equality comparison operator.
!=
Not equal comparison operator.
and
Logical AND; True if both operands are True.
or
Logical OR; True if at least one operand is True.
not
Logical NOT; inverts the boolean value.
in
Membership test; True if item is in sequence.
is
Identity test; True if both refer to same object.
//
Floor division; divides and rounds down.
%
Modulo; returns the remainder of division.
**
Exponentiation; raises to a power.
list comprehension
Compact way to create lists: [x for x in iterable].
dict comprehension
Compact way to create dicts: {k:v for k,v in iterable}.
set comprehension
Compact way to create sets: {x for x in iterable}.
with statement
Context manager that ensures resources are cleaned up.
file.read()
Reads the entire file as a string.
file.readline()
Reads one line from the file.
file.readlines()
Reads all lines into a list.
file.write()
Writes a string to the file.
file.close()
Closes the file and frees resources.
class
Keyword to define a new class (blueprint for objects).
self
Reference to the current instance in a method.
__init__
Constructor method called when creating an instance.
inheritance
A class inheriting attributes/methods from a parent class.