labSheet

Table of Contents

Lab CheatSheet

The minimal code that is expected of the student for each of the lab is collated together in one place, for the benefit of the student, faculty and mentor. Practice problems around the base code will also need to be exercised during the labs.

[TOC]

Lab 1

Algorithmic, Tuples, Modulo Arithmetic, Global Scope (vs) Local Scope, Indefinite looping (while keyword), if-else statement, Recursion

Lab 2

Lab 3

Lab 4

Alternative

Alternative

Using Bisect module in the Python library

Lab 5

Alternative

using List comprehension

Lab 6

Alternative

using reduce function

using lambda function

using max

Lab 7

Alternative

Note: it returns the sorted list without duplicates, and therefore the original order may not be maintained (aka unstable).

Lab 8

Lab 9

Alternative

Lab 10

Lab 11

Alternative

Lab 12

Alternative

Output:

Last updated