# Python: Test whether a given integer is pandigital number or not

## Python Basic - 1: Exercise-106 with Solution

From Wikipedia,

In mathematics, a Pandigital number is an integer that in a given base has among its significant digits each digit used in the base at least once.

For example, 1223334444555556666667777777888888889999999990 is a Pandigital number in base 10. The first few Pandigital base 10 numbers are given by 1023456789, 1023456798, 1023456879, 1023456897, 1023456978, 1023456987, 1023457689.

Write a Python program to test whether a given integer is a Pandigital number or not.

**Sample Solution**:

**Python Code:**

```
def is_pandigital_num(n):
return len(set(str(n))) == 10
n = 1023456897
print("Original number:",n)
print("Check the said number is Pandigital number or not?")
print(is_pandigital_num(n))
n = 1023456798
print("Original number:",n)
print("Check the said number is Pandigital number or not?")
print(is_pandigital_num(n))
n = 1023457689
print("Original number:",n)
print("Check the said number is Pandigital number or not?")
print(is_pandigital_num(n))
n = 1023456789
print("Original number:",n)
print("Check the said number is Pandigital number or not?")
print(is_pandigital_num(n))
n = 102345679
print("Original number:",n)
print("Check the said number is Pandigital number or not?")
print(is_pandigital_num(n))
```

Sample Output:

Original number: 1023456897 Check the said number is Pandigital number or not? True Original number: 1023456798 Check the said number is Pandigital number or not? True Original number: 1023457689 Check the said number is Pandigital number or not? True Original number: 1023456789 Check the said number is Pandigital number or not? True Original number: 102345679 Check the said number is Pandigital number or not? False

**Flowchart:**

**Python Code Editor:**

**Have another way to solve this solution? Contribute your code (and comments) through Disqus.**

**Previous:** Write a Python program to check whether a given sequence is linear, quadratic or cubic.

**Next:** Write a Python program to check whether a given number is Oddish or Evenish.

**What is the difficulty level of this exercise?**

Test your Programming skills with w3resource's quiz.

**Weekly Trends**- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join