함수 (1) 썸네일형 리스트형 [Python] True 또는 Flase로 답하는 함수 1. 숫자인가? st1 = "123" st2 = "OneTwoThree" st1.isdigit() True st2.isdigit() False 2. 문자인가? st1.isalpha() False st2.isalpha() True 3. 특정 문자로 시작하거나 끝나는가? # 특정 문자로 시작하는가? str = "Supersprint" str.startswith("Super") True # 특정 문자로 끝나는가? str.endswith("int") True 4. 활용 예시 def main(): pnum = input("스마트폰 번호 입력: ") if pnum.isdigit() and pnum.startswith("010"): print("정상적인 입력입니다.") else: print("정상적이지 않은 입력입니.. 이전 1 다음