This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+-------------------------+--------+---------------------+-------------+ | |
| Type | Number | Alias | Notes | | |
+-------------------------+--------+---------------------+-------------+ | |
| Double | 1 | double | | | |
| String | 2 | string | | | |
| Object | 3 | object | | | |
| Array | 4 | array | | | |
| Binary data | 5 | binData | | | |
| Undefined | 6 | undefined | Deprecated. | | |
| ObjectId | 7 | objectId | | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def collapse(n): | |
sum = 0 | |
for digit in list(str(n)): | |
sum += int(digit) | |
if sum > 9: | |
return collapse(sum) | |
else: | |
return sum |