Python programming Practice
Python programming Practice
vowel or a consonant.
5. Write a program to accept a two digit number check whether sum of digits of a number is even or odd.
6. Write a program to accept a two digit number check whether it is a Special two digit number or not.
A special two-digit number is a number such that when the sum of the digits of the number is added to the
product of its digits, the result is equal to the original two-digit number.
Examples :
input : 59.
output : 59 is a Special Two-Digit Number
Explanation:
Sum of digits = 5 + 9 = 14
Product of its digits = 5 x 9 = 45
Sum of the sum of digits
and product of digits = 14 + 45 = 59
1. Write a program to input a number. find and display its factorial
Factorial is the product of all positive integers less than or equal to n.
Examples: 4! = 4 × 3 × 2 × 1 = 24
2. Write a program to input a number. Check and display whether it is a Niven number or not. (A number is said
to be Niven which is divisible by the sum of its digits).
3. Write a program to accept a number and check whether it is a 'Spy Number' or not. (A number is spy if the sum
of its digits equals the product of its digits.)
4. Write a program to accept a number from the user and check whether it is a Palindrome number or not. A
number is a Palindrome which when reads in reverse order is same as in the right order.
5. Write a program in PYTHON to accept a number. Check and print whether it is a prime number or not.
A prime number is a number which is divisible by 1 and itself only. For example 2, 3, 5, 7, 11, 13 are all prime
numbers.
6. Write a program in PYTHON to accept a number. Check and print whether it is a neon number or not.
A neon number is a number where the sum of digits of square of the number is equal to the number. For
example if the input number is 9, its square is 9*9 = 81 and sum of the digits is 9. i.e. 9 is a neon number.
7. Write a program in Python to accept a number. Check and print whether it is a perfect number or not.
A perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself.
For instance, 6 has divisors 1, 2 and 3, and 1 + 2 + 3 = 6, so 6 is a perfect number.
Explanation
A number is said to be the Harshad number if it is divisible by the sum of its digit.
For example, if number is 156, then sum of its digit will be 1 + 5 + 6 = 12. Since 156 is divisible by 12. So, 156 is a
Harshad number.
. Write a program to input a number and check and print whether it is a Pronic number or not. [Pronic number is
the number which is the product of two consecutive integers.]
Examples:
12 = 3 * 4
20 = 4 * 5
42 = 6 * 7
10. Write a program to input a number and check and print whether it is an automorphic numbe number or not.
An automorphic number is a number whose square ends in the same digits as the number itself. For example, 25
is an automorphic number because (25^2 = 625), and the last two digits of 625 are 25. Similarly, 76 is an
automorphic number because (76^2 = 5776), and the last two digits of 5776 are 76
11. Write a program to input a number and check and print whether it is an abundant number numbe number or
not
An abundant number, also known as an excessive number, is a positive integer for which the sum of its proper
divisors (excluding the number itself) is greater than the number itself.
Examples:
The number 12 is abundant because its proper divisors excluding itself(1, 2, 3, 4, and 6) add up to 16, which is
greater than 12.
The number 8, on the other hand, is not abundant, because its proper divisors (1, 2, and 4) add up to 7, which is
less than 8.