#python #anaconda #jupyter-notebook #visual-code #html #css #javascript #http 제목[re]사용자 지정함수 입력변수 int설정2022-03-22 18:28작성자123def calcAge(now_age, now_year, future_year): assert type(now_age) == type(0) assert type(now_year) == type(0) assert type(future_year) == type(0) future_age = now_age + (future_year - now_year) return future_age위와 같이 기존의 자가 진단에 활용한 assert를 사용하여 원하는 type이 아니면 함수 동작을 멈추게 할 수 있습니다.동작이 멈추는 것이 싫으면 if문으로 예외 처리를 하실 수도 있습니다. 목록수정삭제답변글쓰기 댓글 [0] 댓글작성자(*)비밀번호(*)내용(*) 댓글 등록 더보기이전사용자 지정함수 입력변수 int설정1212022-03-22다음step5 string 쇼핑 총액 계산 프로그램 개발하기김준엽2022-03-22 Powered by MangBoard | 워드프레스 쇼핑몰 망보드