Select Page

## Program for Tower of Hanoi using Python

Introduction The task is to solve Tower of Hanoi problem using python programming. There are set of rules to follow while solving the problem: At a time only one disk is allowed to be moved. Only the uppermost disk is allowed to be moved. Disks can only be placed on...

## Program to print smallest m digit number divisible by n using Python

Introduction The task to find and print the smallest M digit number divisible by N. Program def result(n, m):     x = pow(10, m-1)        if( x % n == 0):        ...

## Program to find product of unique prime factors of a given number using Python

Introduction The task is to print the product of unique prime factors of the given number. Program def find(ip_num): # Initializing product with 1     prod = 1     for num in range(2, ip_num+1):        ...

## Program for Sieve of Eratosthenes using Python

Introduction The task is to print all the prime numbers smaller than or equal to the given number n (given n must be small).   Program def SOE(ip_num): # Initialize all the element with True, the value will be False if p_num[val] is not prime    ...

## Program to print the matrix in Z form using Python

Introduction Given a matrix of size n*n, the task is to print the elements in Z form. Program ip_array = [[1, 2, 3],                     [4, 5, 6],...

## Program for number of stopping station problems using Python

Introduction The task is to find the number of ways we can stop the train at K stations out of N stations between S1 and S2 such that the stopping stations are non-consecutive. Program def find( s, ts): #select s non-consecutive station from ts number of stations...