Python Programming
Semester IV · BCA 254 · 3 credits
0 / 9
chapters done
-
The syllabus asks for
- What is Python?
- Tokens: identifiers, keywords, comments, indentation
- Variables and dynamic typing
- Data types
- Operators
- Type conversion
- Console input and output
- Useful built-in functions
- Seeing the ideas: the people, the machines and the path of a program
Key points
- Python is a readable, interpreted, general-purpose language with a rich library; use Python 3.
- Variables are names bound to objects; types belong to objects, not names.
- Operators follow a precedence table; floats are approximate; use parentheses and tolerances.
- Convert types explicitly; format output with f-strings.
-
The syllabus asks for
- Conditional statements
- The while loop
- The for loop and range
- break, continue, pass and loop else
- Nested loops and patterns
- Classic programs
- Common mistakes
- Seeing the ideas: choices, loops and a very long trip
Key points
- if/elif/else and match choose among alternatives; conditions use comparison and logical operators.
- while repeats until a condition fails; for iterates over iterables; range generates integer sequences.
- break, continue, pass and loop else fine-tune loops; nested loops cost the product of their sizes.
- Classic algorithms (primes, GCD, factorial, Fibonacci, digit sums) are all small loops.
-
The syllabus asks for
- Strings
- Lists
- Tuples
- Sets
- Dictionaries
- Choosing a data structure
- Seeing the ideas: text, code points and four containers
Key points
- Strings are immutable sequences with a rich method set; slicing is the universal tool for sequences.
- Lists are the general-purpose mutable sequence; comprehensions build them concisely; copies are shallow unless you ask for deep.
- Tuples are fixed records, sets give uniqueness and fast membership, dictionaries give key-based lookup.
-
The syllabus asks for
- Defining and calling functions
- Scope: the LEGB rule
- Recursion
- Anonymous functions and functional tools
- Closures, decorators and generators
- Modules and packages
- Seeing the ideas: bricks, scopes and the call stack
Key points
- Functions package logic, with flexible parameter passing, scopes that follow LEGB, and first-class function objects.
- Recursion, closures, decorators and generators are the building blocks of idiomatic Python.
- Modules and packages organise code across files; the standard library covers most everyday tasks.
-
The syllabus asks for
- Text files
- CSV and JSON
- Errors and exceptions
- Handling exceptions
- Seeing the ideas: records, safety switches and what really happens
Key points
- Files are opened with with, read lazily by iteration, and written with write; pathlib handles paths; csv and json handle structured text.
- Exceptions separate normal logic from error handling; try/except/else/finally give precise control, and custom exceptions make errors meaningful.
- Handle only what you can handle; let other exceptions propagate.
-
The syllabus asks for
- Classes and objects
- Encapsulation
- Inheritance and polymorphism
- Special methods and operator overloading
- Dataclasses and composition
- Seeing the ideas: one mould, many objects
Key points
- Classes bundle data and behaviour; objects are instances; self and init are explicit.
- Encapsulation in Python is by convention and properties.
- Inheritance specialises a class, polymorphism lets code treat different objects uniformly, and abstract classes force a common interface.
- Dunder methods integrate your classes with the language; dataclasses and composition keep designs small.
-
The syllabus asks for
- NumPy
- Pandas
- Matplotlib
- Seeing the ideas: data made visible
Key points
- NumPy arrays give fast, vectorised numerical work with broadcasting and built-in statistics and linear algebra.
- Pandas turns CSV-style data into DataFrames that can be cleaned, filtered, grouped and merged in a few expressions.
- Matplotlib communicates the results as charts.
-
The syllabus asks for
- Regular expressions
- SQLite from Python
- Unit testing with unittest
- Virtual environments and pip
- Seeing the ideas: patterns, records, checks and isolation
Key points
- Regular expressions find and transform text patterns; raw strings and named groups keep them readable.
- sqlite3 gives a zero-setup SQL database; parameterised queries stop injection and with con: gives atomic transactions.
- Unit tests make change safe; virtual environments keep projects reproducible.
-
The syllabus asks for
- Project 1: student-record manager
- Project 2: text analyser
- Project 3: a small bank in SQLite
- Habits of a good Python programmer
- Seeing the ideas: from requirements to a working program
Key points
- Small programs combine classes, files, text processing, databases and exceptions; keep the pieces short and independent.
- Persistence can be a JSON file for small data or SQLite for structured, transactional data.
- Tests, parameterised queries and clear errors turn scripts into dependable software.
No chapter matches. Try another word.
The paper
TU assessment: 60% final examination set by the university, 40% internal (assignments, lab work, attendance). Confirm the split in your college's notice.
Where the hours go
Teaching hours are the board's guide to how much of the paper each part carries.
- Unit 3 · Strings and Built-in Data Structures7 h
- Unit 4 · Functions, Modules and Packages7 h
- Unit 6 · Object-Oriented Programming in Python7 h
- Unit 7 · Data Analysis and Visualisation: NumPy, Pandas, Matplotlib7 h
- Unit 1 · Introduction to Python and Basic Elements6 h
- Unit 5 · File Handling and Exception Handling6 h
- Unit 2 · Control Flow5 h
- Unit 8 · Regular Expressions, Databases and Testing5 h
- Unit 9 · Putting It Together: Three Complete Programs4 h