From e1ef6a024af6e71639b2344a95e712c6ff387443 Mon Sep 17 00:00:00 2001 From: ARYA CHAKRABORTY <75772793+AryaChakraborty@users.noreply.github.com> Date: Sat, 8 Oct 2022 19:35:15 +0530 Subject: [PATCH 1/2] Add files via upload --- pandigital.py.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 pandigital.py.py diff --git a/pandigital.py.py b/pandigital.py.py new file mode 100644 index 0000000..5f85073 --- /dev/null +++ b/pandigital.py.py @@ -0,0 +1,22 @@ +# python program to check whether a number is pandigital or not +# example - 10243. contains all digits from 0-4 +# NOTE - 01234 is equal to 1234, leading zeroes are not considered + +import math + +def calculate_digits(x) : + return int(math.log(x, 10)) + 1 + +def isPandigital(x) : + no_of_digits = calculate_digits(x) + x = str(x) + to_array = [char for char in x] + to_array.sort() + copy = '' + for i in range(no_of_digits) : + copy += str(i) + to_array_copy = [char for char in copy] + return to_array_copy == to_array + +n = int(input()) +print(isPandigital(n)) \ No newline at end of file From 71b1506578fb8b0afd17eb77e8b49f668233ba61 Mon Sep 17 00:00:00 2001 From: ARYA CHAKRABORTY <75772793+AryaChakraborty@users.noreply.github.com> Date: Mon, 10 Oct 2022 21:57:02 +0530 Subject: [PATCH 2/2] Add files via upload --- pandigital_output.md.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 pandigital_output.md.md diff --git a/pandigital_output.md.md b/pandigital_output.md.md new file mode 100644 index 0000000..a1ce9fe --- /dev/null +++ b/pandigital_output.md.md @@ -0,0 +1,2 @@ +12034 +True