#P0026. 幸运数字
幸运数字
1. Description
Code a function which takes an integer as input and check if this integer is a "lucky number"
The definition of a lucky number is as follows:
- Add all digits of this number together
- If the result is 1, the number is a lucky number
- Otherwise, repeat the same process with the result until a single-digit number is obtained
For example,
2. Input & Output
Input:
- An integer
- Use
input()as input. Notice that the value you get frominput()is a string
Output:
- A boolean
True/False - Use
print()for your output
Example
# Input:
100
# Output:
True
# Input:
299
# Output:
False