Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4f71d32

Browse files
Create solutions4.py
1 parent f3c4e3a commit 4f71d32

File tree

1 file changed

+13
-0
lines changed
  • Problem Solving in Python/01_Basic Problems/Solutions

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
number = int(input("Enter the number: "))
2+
numStr = str(number)
3+
exponent = len(numStr)
4+
sum = 0
5+
for i in numStr:
6+
sum = sum + pow(int(i), exponent)
7+
if(sum == number):
8+
print("This number is Armstrong Number")
9+
else:
10+
print("This number is not an Armstrong Number")
11+
12+
# Complexity: O(logn)
13+
# Space Complexity: O(1) # because we are using a constant amount of space.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /