-
Notifications
You must be signed in to change notification settings - Fork 0
Silver #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
eunbileeme
wants to merge
5
commits into
main
Choose a base branch
from
silver
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Silver #42
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# 1. | ||
# ex. [[80, 70], [90, 50], [40, 70], [50, 80]] | ||
|
||
def solution(score): | ||
average = [] # Q. 평균 변수 이름으로 average 괜찮나요? | ||
answer = [] | ||
for grade in score: | ||
average.append(sum(grade) // len(grade)) | ||
average = sorted(average, reverse=True) | ||
# print(average) : [75, 70, 65, 55] | ||
for grade in score: | ||
answer.append(average.index(sum(grade) // len(grade))) # Q. [[1, 2], [1, 1], [1, 1]] : [1, 1, 1]을 어떻게 처리할지 궁금합니다. | ||
return [idx + 1 for idx in answer] # = list(map(lambda idx: idx + 1, answer)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# 1. | ||
# keypoint | ||
# 1차원 배열 in/not in 2차원 배열 (O) | ||
# but, 1차원 배열의 요소 in/not in 2차원 배열 (X) | ||
# ex. id_pw[0] in db (X) | ||
# ex. id_pw[0] in db[0] (O) | ||
|
||
def solution(id_pw, db): | ||
answer = ["login", "wrong pw", "fail"] | ||
if id_pw in db: | ||
return answer[0] | ||
else: | ||
for idx in range(len(db)): | ||
if id_pw[0] in db[idx]: | ||
if id_pw[1] not in db[idx]: | ||
return answer[1] | ||
return answer[2] | ||
|
||
# 2. | ||
def solution(id_pw, db): | ||
if db_pw := dict(db).get(id_pw[0]): # Q. | ||
return "login" if db_pw == id_pw[1] else "wrong pw" | ||
return "fail" | ||
|
||
# 3. | ||
# ex. id_pw, db | ||
# ["meosseugi", "1234"], [["rardss", "123"], ["yyoom", "1234"], ["meosseugi", "1234"]] | ||
|
||
def solution(id_pw, db): | ||
answer = '' | ||
a, b = id_pw[0], id_pw[1] | ||
for pk, pw in db: | ||
# print(pk,pw) : rardss 123 yyoom 1234 meosseugi 1234 | ||
if pk == a and pw == b: | ||
return "login" | ||
for pk, pw in db: | ||
if pk == a: | ||
return "wrong pw" | ||
return "fail" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# 1. | ||
# keypoint | ||
# Z 바로 전 값 = 마지막 값 제거 : pop() | ||
|
||
def solution(s): | ||
answer = [] | ||
for i in s.split(): # for문에 split() 즉시 적용 가능 | ||
if i == "Z": | ||
answer.pop() | ||
else: | ||
answer.append(int(i)) # str → int 즉시 적용 가능 | ||
return sum(answer) |
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.
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.
굿
avg도 많이 써요