Write a python function find_smallest_number() which accepts a number n and returns the smallest number having n divisors. Handle the possible errors in the code written inside the function.












Source Code:-

2 comments:

  1. // Solution in JAVA programming language

    package tcsNqtPractice;

    import java.util.Scanner;

    public class Assignment44 {

    public static void main(String[] args)
    {
    Scanner scan = new Scanner(System.in);
    System.out.println("Enter the Number: ");
    int num = scan.nextInt();

    int value = 2;
    int rem = 0;
    while(true) {
    rem = noOfDivisors(value);
    if(rem == num) {
    System.out.println("The No. with divisors: "+ value);
    break;
    }else {
    value = value + 1;
    }
    }

    }
    public static int noOfDivisors(int n) {
    int count = 0;
    for(int i=1; i<=n; i++) {
    if(n%i == 0) {
    count ++;
    }
    }
    return count;
    }
    }

    ReplyDelete

Write a python function, find_correct() which accepts a dictionary and returns a list as per the rules mentioned below. The input dictionary will contain correct spelling of a word as key and the spelling provided by a contestant as the value.

Write a python function,  find_correct()  which accepts a dictionary and returns a list as per the rules mentioned below. The input diction...