Python Programming Syllabus


A) Running instructions in Interactive interpreter and a Python Script

B) Write a program to purposefully raise Indentation Error and Correct it



A) Write a program to compute distance between two points taking input from the user (Pythagorean Theorem)

B) Write a program add.py that takes 2 numbers as command line arguments and prints its sum.


A) Write a Program for checking whether the given number is a even number or not.

B) Using a for loop, write a program that prints out the decimal equivalents of 1/2, 1/3, 1/4, . . . , 1/10

C) Write a program using a for loop that loops over a sequence. What is sequence ?

D) Write a program using a while loop that asks the user for a number, and prints a countdown from that number to zero.



A) Find the sum of all the primes below two million.

B) Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.



A) Write a program to count the number of characters in the string and store them in a dictionary data structure.

B) Write a program to use split and join methods in the string and trace a birthday with a dictionary data structure.

EXERCISE - 6 DATA STRUCTURES

A) Write a program combine_lists that combines these lists into a dictionary.

B) Write a program to count frequency of characters in a given file. Can you use character frequency to tell whether the given file is a Python program file, C program file or a text file?


A) Write a program to print each line of a file in reverse order.

B) Write a program to compute the number of characters, words and lines in a file.


A) Write a function ball_collide that takes two balls as parameters and computes if they are colliding. Your function should return a Boolean representing whether or not the balls are colliding.

B) Find mean, median, mode for the given set of numbers in a list.


A) Write a function nearly_equal to test whether two strings are nearly equal. Two strings a and b are nearly equal when a can be generated by a single mutation on b.

B) Write a function dups to find all duplicates in the list.

C) Write a function unique to find all the unique elements of a list.


A) Write a function cumulative_product to compute cumulative product of a list of numbers.

B) Write a function reverse to reverse a list. Without using the reverse function.

C) Write function to compute gcd, lcm of two numbers.


A) Write a program that defines a matrix and prints.

B) Write a program to perform addition of two square matrices.

C) Write a program to perform multiplication of two square matrices.