Family Day update
This commit is contained in:
parent
aac6731f2c
commit
9ad63ea473
2442 changed files with 39761 additions and 8255 deletions
12
Task/FizzBuzz/Python/fizzbuzz-12.py
Normal file
12
Task/FizzBuzz/Python/fizzbuzz-12.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
def numsum(n):
|
||||
''' The recursive sum of all digits in a number
|
||||
unit a single character is obtained'''
|
||||
res = sum([int(i) for i in str(n)])
|
||||
if res < 10: return res
|
||||
else : return numsum(res)
|
||||
|
||||
for n in range(1,101):
|
||||
response = 'Fizz'*(numsum(n) in [3,6,9]) + \
|
||||
'Buzz'*(str(n)[-1] in ['5','0'])\
|
||||
or n
|
||||
print(response)
|
||||
Loading…
Add table
Add a link
Reference in a new issue