Sunday, November 29, 2020

CMS-A-DSE-B--2-TH: Programming using Python 3 DSE-B: Choice-2: Theory, Credit: 04, Contact hour: 60.

 Introduction to the Python

Interpreted vs. compiled languages. Bytecodes. The importance of whitespace.

Variables and the lack of explicit data types and how Python uses the concepts of duck,

strong, and static typing, to figure out data types in runtime.

The assignment operator, the binding of names to objects, and aliasing.

Keywords and their significance.

04 hours

Strings: definition, declaration, and immutability, string constants, declaration, and the

equivalence of single and double quotes. Multi-line strings. Raw strings. String formatting

using the format function and the % operator. f-strings in Python 3.6+. Built-in functions:

count, find, replace, upper, lower, strip, etc. Time and space complexities of the functions

and operations.

Lists: definition, declaration, and mutability. Nested lists. Indexing and slicing: same as

strings. List comprehensions. The split and join methods. Built-in list functions – append,

extend, count, find, index, etc. Time and space complexities of the functions and

operations.

Tuples: definition, declaration, and immutability. Packing and unpacking lists and tuples.

The + and * operators on strings, lists, and tuples. Indexing and slicing strings, lists, and

tuples.

06 hours

Conditionals, Iterators, and Generators

Conditionals: If, elif, and else statements. Nested conditionals. Containment checking in

containers using the in keyword.

Looping constructs: while and for loops. Flow control using break, continue, and pass.

Nested loops.

Generators: range, zip, sorted, reversed, and enumerate.

15 hours

User-defined Functions and Recursion

Functions: definition, function signature, positional, default, and keyword arguments.

Documentation strings. Unnamed functions – lambda, filter, and map.

Recursion: basic idea, implementing recursion, sharing variables across the recursion

stack, modifying the size of the recursion stack.

10 hours

File Handling and Exception Handling

File handling: open and close methods, the different read and write modes. Using the with

open approach to files. read, readline, readlines functions. The csv module for efficient

read/write of structured data. The pickle module for persistent storage of variables in a

program.

Exception handling: the popular errors- Name Error, Value Error, Syntax Error, Key

Error, Attribute Error, etc, and their cause and effects. Using try-except blocks for

graceful handling of exceptions.

05 hours

Unordered data types - Sets and Dictionaries

Basic concepts of hashing: hash functions, open chain, closed chain, advantages and

disadvantages compared to conventional ordered data types. The hash() function in

Python.

Sets and frozensets: definition, declaration, mutability, and advantages over lists / tuples.

05 hours

Insertion, deletion, union, intersection, and other built-in operations. Time and space

complexities of the functions and operations.

Dictionaries: Concept of keys and values. Immutability requirement for keys. Basic

operations on dictionaries. Iterating over the keys and key, value pairs of a dictionary.

Dictionary inversions

Intro to Object Oriented Programming

The Python data model, magic methods (__init__, __str__, __eq__, etc) and their utilities,

accessing and mutating data, constructors, class methods, and the lack of explicit access

modifiers of class methods – naming conventions of private, protected, and public

variables and methods.

Inheritance: inheriting a parent class, the super() method. Basic multiple inheritance.

No comments:

Post a Comment