Skip to content
This repository has been archived by the owner on Jun 19, 2020. It is now read-only.

연습문제 26 입력 값 검증 #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

impactrudia
Copy link
Contributor

코딩 트레이닝 by 브라이언호건 27번문제
issue #5

코딩 트레이닝 by 브라이언호건 27번문제
@impactrudia impactrudia self-assigned this Jun 28, 2018
@impactrudia impactrudia requested a review from a team June 28, 2018 10:57
Copy link
Member

@ohahohah ohahohah left a 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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

유효성 검사 부분을 분리하는건 어떻게 생각하시나요? 한 메소드에 여러가지 역할들이 구현되어있는 거 같아요

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validateInput 구현 중이신건가요?

Copy link
Contributor Author

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

유효성 검사 부분을 분리하는건 어떻게 생각하시나요? 한 메소드에 여러가지 역할들이 구현되어있는 거 같아요

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위에 check_value_name 처럼요

Copy link
Contributor Author

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 else는 아무 역할이 없는 거 같은데 삭제하는 게 저희 연습하는 취지에 맞는 거 같아요.

Copy link
Contributor Author

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]*$')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정규표현식 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zipcode 는 글자수 제한이 없나요? 궁금

Copy link
Contributor Author

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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

함수명은 동사로 하는 컨벤션 지켜주세요

Copy link
Contributor Author

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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

함수명은 동사로 하는 컨벤션 지켜주세요

Copy link
Contributor Author

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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

함수명은 동사로 하는 컨벤션 지켜주세요

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- input에서 enter로 메소드이름 컨벤션
- else remove
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants