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 7711b5a

Browse files
author
Amogh Singhal
authored
Create isAngstrom.py
1 parent 594db94 commit 7711b5a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

‎bits_wilp/isAngstrom.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
def isAngstrom(n):
2+
result = False
3+
sum = 0
4+
order = len(n)
5+
6+
for i in n:
7+
sum = sum + int(i)**order
8+
9+
if sum == int(n):
10+
result = True
11+
return result
12+
13+
print("Please enter a number: ")
14+
num = input()
15+
flag = isAngstrom(num)
16+
17+
if flag:
18+
print(num, "is an Angstrom number")
19+
else:
20+
print(num, "is NOT an Angstrom number")

0 commit comments

Comments
(0)

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