MCPcopy Index your code
hub / github.com/geekcomputers/Python / isHappyNumber

Function isHappyNumber

happy_num.py:4–12  ·  view source on GitHub ↗
(num)

Source from the content-addressed store, hash-verified

2
3# isHappyNumber() will determine whether a number is happy or not
4def isHappyNumber(num):
5 rem = sum = 0
6
7 # Calculates the sum of squares of digits
8 while num > 0:
9 rem = num % 10
10 sum = sum + (rem * rem)
11 num = num // 10
12 return sum
13
14
15num = 82

Callers 1

happy_num.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected