Python excercises


☞ The matrix has R rows and C columns. Write a program to generate a matrix having R rows and C    columns such that all the numbers are in increasing order starting from the number 1 and in a row-wise.


☞ Given an integer number n, define a function named printDict() which can print a dictionary where the keys are numbers between 1 and n (both included) and the values are square of keys. The function printDict() doesn't take any argument.


☞ You are given input which contains only digits 0's and 1's. Your task is to make all digits the same by just flipping one digit (i.e. 0 to 1 or 1 to 0) only. If it is possible to make all the digits the same by just flipping one digit then return True else return False.


☞ A semi prime number is an integer which can be expressed as the product of two prime numbers. The two primes in the product may equal each other. For example 15 = 3*5 is a semiprime number. Given an integer number N, find whether it can be expressed as a sum of two semi-primes or not (not necessarily distinct).


☞ Write a program to convert the given square matrix into a lower triangular matrix.

No comments:

Post a Comment