나는 이렇게 학습한다/Algorithm & SQL

1217. Regexp Basics - is it a digit?

daco2020 2022. 12. 17. 14:56

Implement String#digit? (in Java StringUtils.isDigit(String)), which should return true if given object is a digit (0-9), false otherwise.



Solution:

def is_digit(n):
    return len(n) == 1 and n.isdigit()