Skip to content
Prev Previous commit
Next Next commit
Add doctests and annotate function params and return values for get_d…
…igits()
  • Loading branch information
peteryao7 committed Oct 8, 2020
commit 3da81bc4746e9787aa261e672f61423ad1a105cf
9 changes: 8 additions & 1 deletion project_euler/problem_62/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,16 @@ def solution():

num += 1

def get_digits(num):
def get_digits(num: int) -> str:
"""
Computes the sorted sequence of digits of the cube of num.

>>> get_digits(3)
'27'
>>> get_digits(99)
'027999'
>>> get_digits(123)
'0166788'
"""
cube = num ** 3
digits = [str(x) for x in str(cube)]
Expand Down