Skip to content

Commit d29c9e2

Browse files
authored
Add files via upload
1 parent c13515d commit d29c9e2

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

Day8/SortStringAsLike_sb.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# 풀이 실패..
2+
def solution(strings, n):
3+
a = []
4+
answer = []
5+
strings.sort()
6+
for i in strings:
7+
a.append(i[n])
8+
a.sort()
9+
10+
for i in a:
11+
for j in range(len(a)):
12+
if i == strings[j][n]:
13+
answer.append(strings[j])
14+
strings[j] = '0' * 100
15+
return answer
16+
17+
str1 = ["sun", "bed", "car"]
18+
str2 = ["abce", "abcd", "cdx"]
19+
n1 = 1
20+
n2 = 2
21+
22+
print(solution(str1, n1))
23+
print(solution(str2, n2))

Day8/StringManipulate_sb.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def solution(s):
2+
answer = True
3+
4+
if (len(s) == 4 or len(s) == 6) and s.isdigit():
5+
return True
6+
else:
7+
return False
8+
return answer
9+
10+
s1 = "a234"
11+
s2 = "1234"
12+
print(solution(s1))
13+
print(solution(s2))

Day8/StringofPAndY_sb.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def solution(s):
2+
answer = True
3+
s = str(s).lower()
4+
if s.count('p') != s.count('y'):
5+
return False
6+
# [실행] 버튼을 누르면 출력 값을 볼 수 있습니다.
7+
print('Hello Python')
8+
return True
9+
10+
s1 = "pPoooyY"
11+
s2 = "Pyy"
12+
13+
print(solution(s1))
14+
print(solution(s2))

0 commit comments

Comments
 (0)