Skip to main content

Python

What's here

1 · Basics

PageCovers
Values and Typestype() vs isinstance(), dynamic typing, casting, truthiness
Variables and NamingIdentifier rules, the 35 keywords, PEP 8 conventions
Data TypesAll eight built-ins — int float str bool list tuple dict set
Expressions and OperatorsArithmetic, precedence, and five ways to structure the same answer
F-StringsFormat specs, alignment, padding, debug mode
Input and Outputinput(), print() with sep and end

2 · Control Flow

PageCovers
Conditional Statementsif / elif / else, nesting, and or not, ternary, match
Loopsfor, range(), while, break, continue, the loop else, nesting

3 · Collections

PageCovers
Strings and SlicingIndexing, the three-part slice, immutability, string methods
ListsMutating methods, sort vs sorted, the reference trap, comprehensions
TuplesThe trailing comma, shallow immutability, unpacking, tuple vs list
Dictionaries and SetsKey lookup, .get(), hashable keys, set algebra

4 · NumPy

PageCovers
Arrays and AttributesCreating arrays, the six attributes, dtypes, array vs list
Indexing, Slicing and Reshaping2-D access, views vs copies, boolean masks, reshape
Operations and BroadcastingElement-wise maths, broadcasting rules, ufuncs, @, sorting
Aggregations and Statisticsmean/median/std, the axis argument, ddof, nan

5 · Pandas

PageCovers
Series and DataFramesThe two structures, the index, label vs position
Loading and Saving Dataread_csv/excel/json, writing out, index=False
Inspecting Datahead, shape, dtypes, info(), describe()
Cleaning Datafillna vs dropna, duplicates, type conversion
Selecting and Transformingloc vs iloc, filtering, sorting, groupby, merge

6 · Statistics & EDA

PageCovers
Descriptive StatisticsMean/median/mode, range, variance, std, quartiles, IQR outliers
Correlation and CovarianceThe −1 to +1 scale, why covariance can't be compared, what Pearson misses
Exploratory Data AnalysisThe six-step EDA workflow, crosstab, binning

7 · Visualization

PageCovers
Choosing a ChartWhich chart answers which question, and which library to use
MatplotlibLine, bar, histogram, scatter, pie, subplots, savefig
Seaborndata=/x=/y=, box, violin, heatmap, pair plot
PlotlyInteractive charts, hover_data, bubble charts, exporting

Practice questions

Most pages end with a Practice Questions section, drawn from the Unit 1 and Unit 2 question banks and grouped by their original section so you can cross-reference the paper.

TagMeans
[OUT]Predict the output. Exact text — brackets, quotes, spacing, NaN, and the dtype: footer all count.
[PROG]Write the program. Complete, runnable code.
[THEORY]Explain in words.
[PLOT]Write the plotting code. Include the title, axis labels and plt.show().

The number in [ ] is the mark allocation.

No answers are included, deliberately. Work each one out on paper first, then check it by running the code — the page above it has everything you need.

Notes on [OUT] questions:

  • type(x) prints <class 'int'>, not int
  • Python prints strings with single quotes: 'mouse', not "mouse"
  • Tuples print with ( ), lists with [ ] — don't swap them
  • A Series prints its index on the left and a dtype: line at the bottom; both are output
  • Missing values print as NaN, never as None or blank
  • One NaN makes the whole column float64, so 85 prints as 85.0
  • If a line raises, name the exception type and note that execution stops there

Notes get published a topic at a time, once the material is actually worked through rather than just collected.