Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
search for highest digit solution in Creative category for Max Digit by lNyx
from math import floor, log10
def max_digit(number: int) -> int:
for i in range(10)[::-1]:
if str(i) in str(number):
return i
return 0
if __name__ == '__main__':
print("Example:")
print(max_digit(0))
# These "asserts" are used for self-checking and not for an auto-testing
assert max_digit(0) == 0
assert max_digit(52) == 5
assert max_digit(634) == 6
assert max_digit(1) == 1
assert max_digit(10000) == 1
assert max_digit(9) == 9
print("Coding complete? Click 'Check' to earn cool rewards!")
April 27, 2020
Comments: