-
Notifications
You must be signed in to change notification settings - Fork 0
연습문제 26 입력 값 검증 #6
base: master
Are you sure you want to change the base?
Conversation
코딩 트레이닝 by 브라이언호건 27번문제
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다. 코멘트 확인해주세요
answer = input("Enter the ZIP code:") | ||
p = re.compile('^[0-9]*$') | ||
m = p.match(answer) | ||
if m: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
유효성 검사 부분을 분리하는건 어떻게 생각하시나요? 한 메소드에 여러가지 역할들이 구현되어있는 거 같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validateInput 구현 중이신건가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
분리하겠습니다. validateInput은 구현중이였어요~
answer = input("Enter the Employee ID:") | ||
p = re.compile('([a-zA-Z]{1,2})\-([0-9]{4})') | ||
m = p.match(answer) | ||
if m: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
유효성 검사 부분을 분리하는건 어떻게 생각하시나요? 한 메소드에 여러가지 역할들이 구현되어있는 거 같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
위에 check_value_name 처럼요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 분리하겠습니다~
print("The "+label+" name must be filled in") | ||
elif len(answer) == 1: | ||
print("\""+answer+"\" is not a valid "+label+ " name. It is too short.") | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 else는 아무 역할이 없는 거 같은데 삭제하는 게 저희 연습하는 취지에 맞는 거 같아요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그렇네여!
|
||
def input_zip_code(self): | ||
answer = input("Enter the ZIP code:") | ||
p = re.compile('^[0-9]*$') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
정규표현식 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zipcode 는 글자수 제한이 없나요? 궁금
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
예에~ zipcode제한수는 없어여 :)
else: | ||
pass | ||
|
||
def input_name(self, label): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
함수명은 동사로 하는 컨벤션 지켜주세요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
input도 동사로 쓸수있던데 어떤게 더 나은 이름일까요? enter?
a = input("Enter the "+label+" name:") | ||
self.check_value_name(label, a) | ||
|
||
def input_zip_code(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
함수명은 동사로 하는 컨벤션 지켜주세요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네~~ 컨벤션!!
else: | ||
print('The ZIP code must be numeric:' + answer) | ||
|
||
def input_employee_id(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
함수명은 동사로 하는 컨벤션 지켜주세요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넹
- input에서 enter로 메소드이름 컨벤션 - else remove
코딩 트레이닝 by 브라이언호건 27번문제
issue #5