File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1
1
"""
2
- An Armstrong number is a number that is equal to the sum of the cubes of its digits.
2
+ An Armstrong number is equal to the sum of the cubes of its digits.
3
3
For example, 370 is an Armstrong number because 3*3*3 + 7*7*7 + 0*0*0 = 370.
4
4
An Armstrong number is often called Narcissistic number.
5
5
"""
6
6
7
7
8
8
def armstrong_number (n : int ) -> bool :
9
9
"""
10
- This function checks if a number is Armstrong or not.
10
+ Return True if n is an Armstrong number or False if it is not.
11
11
12
12
>>> armstrong_number(153)
13
13
True
@@ -42,9 +42,11 @@ def armstrong_number(n: int) -> bool:
42
42
return n == sum
43
43
44
44
45
- # In main function user inputs a number to find out if it's an Armstrong or not. Th function armstrong_number is called.
46
45
def main ():
47
- num = int (input ("Enter an integer number to check if it is Armstrong or not: " ).strip ())
46
+ """
47
+ Request that user input an integer and tell them if it is Armstrong number.
48
+ """
49
+ num = int (input ("Enter an integer to see if it is an Armstrong number: " ).strip ())
48
50
print (f"{ num } is { '' if armstrong_number (num ) else 'not ' } an Armstrong number." )
49
51
50
52
You can’t perform that action at this time.
0 commit comments