MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / get_digits

Function get_digits

project_euler/problem_062/sol1.py:47–58  ·  view source on GitHub ↗

Computes the sorted sequence of digits of the cube of num. >>> get_digits(3) '27' >>> get_digits(99) '027999' >>> get_digits(123) '0166788'

(num: int)

Source from the content-addressed store, hash-verified

45
46
47def get_digits(num: int) -> str:
48 """
49 Computes the sorted sequence of digits of the cube of num.
50
51 >>> get_digits(3)
52 '27'
53 >>> get_digits(99)
54 '027999'
55 >>> get_digits(123)
56 '0166788'
57 """
58 return "".join(sorted(str(num**3)))
59
60
61if __name__ == "__main__":

Callers 1

solutionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected