NPTEL PROGRAMMING ASSIGNMENTS
The Joy of Computing using Python
Week 4: Programming Assignment 1 - Factorial
Write a program that takes a number as input and prints its factorial as output.
Input Format:
Single line of input contains a number
Output Format:
Display the value of the factorial corresponding to the input
Example:
Input:
3
Output:
6
Week 4: Programming Assignment 2 - Multiples
Given a list of n integers, count the number of integers in the list that are either a multiple of 3 or a multiple of 5. (All the numbers are guaranteed to be distinct).
Input Format:
Single line of input contains a list of space separated integers
Output Format:
Print the count of numbers that are divisible either by 3 or 5
Example:
Input:
1 3 5 6 7 9 11 13 15 18 20 21
Output:
8
Week 4: Programming Assignment 3 - Arrangements
Given a list of binary numbers (0s and 1s), determine the number of possible arrangements of distinct binary sequences using given 0s and 1s.
Input Format:
Single line of input containing 0s and 1s
Output Format:
Print an integer value indicating the number of possible arrangements using given 0s and 1s
Example:
Input:
0 1 0 1
Output:
6
Explanation:
For the given input, the possible distinct binary sequences that can be formed are : 0011, 0101, 0110, 1001, 1010, 1100.
Hence the output is 6.