Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
이름 입력
.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
을 통해 공백으로 입력하는 경우를 구분했습니다..contains를 통해 Set에서의 학생의 존재 여부를 확인합니다.
이름 삭제
성적 입력
성적을 저장은 key값에 "이름 과목", value에 성적을 저장했습니다. 성적을 호출할 경우에 이름과 성적을 동시에 입력하기 때문에 하나의 key값으로 묶었습니다.
성적 삭제
평점 확인
종료
고민사항
입력을 받아 올 때
let input = readLine()!
을 사용했는데 이 때 '입력 값이 nil이여서 프로그램이 종료가 나지 않을까?' 였습니다. 실행했을 때 입력을 스페이스, 그냥 엔터를 눌러도 아무런 문제가 없어서 기존의 것을 사용했습니다.성적 추가할 때 올바른 성적을 입력했는지 확인하기 위해 이렇게 사용했는데
let score = components.contains("A+") || components.contains("A0") || components.contains("B+") || components.contains("B0") || components.contains("C+") || components.contains("C0") || components.contains("D+") || components.contains("D0") || components.contains("F")
가독성을 높이기 위한 다른 방법을 모르겠습니다.