본문 바로가기
나는 이렇게 학습한다/Algorithm & SQL

1217. Regexp Basics - is it a digit?

by daco2020 2022. 12. 17.

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()


'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글

1219. Return the day  (0) 2022.12.19
1218. Remove First and Last Character  (0) 2022.12.18
1216. Define a card suit  (0) 2022.12.17
1215. Is it even?  (0) 2022.12.15
1214. Find the position!  (0) 2022.12.14