Skip to content

Commit ab97797

Browse files
authored
Add files via upload
1 parent 89b74b7 commit ab97797

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

Day11/DescInteger_sb.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
def solution(n):
2+
answer = 0
3+
temp = n
4+
tempList = []
5+
while temp != 0:
6+
tempList.append(temp % 10)
7+
temp = temp // 10
8+
tempList.sort()
9+
tempList.reverse()
10+
tempStr = ''
11+
for i in tempList:
12+
tempStr += str(i)
13+
14+
answer = int(tempStr)
15+
return answer
16+
17+
n = 118372
18+
print(solution(n))

Day11/ReversedOfPosition_sb.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def solution(n):
2+
answer = list(map(int, str(n)[::-1]))
3+
return answer
4+
5+
n = 12345
6+
print(solution(n))

Day11/StrangeStr_sb.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def solution(s):
2+
answer = ''
3+
idx = 0
4+
for i in range(len(s)):
5+
if s[i].isalpha():
6+
if idx % 2 == 0:
7+
answer += s[i].upper()
8+
else : answer += s[i].lower()
9+
idx += 1
10+
else :
11+
idx = 0
12+
answer += ' '
13+
return answer
14+
15+
s = "try hello world"
16+
print(solution(s))

Day11/SumOfMeasure_sb.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def solution(n):
2+
answer = [n]
3+
n1 = int(n / 2)
4+
while n1 >= 1:
5+
if n % n1 == 0:
6+
answer.append(n1)
7+
n1 -= 1
8+
return sum(answer)
9+
10+
n1 = 12
11+
n2 = 5
12+
13+
print(solution(n1))
14+
print(solution(n2))

Day11/SumOfPosition_sb.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def solution(n):
2+
# [실행] 버튼을 누르면 출력 값을 볼 수 있습니다.
3+
print('Hello Python')
4+
5+
return sum([int(i) for i in str(n)])
6+
7+
N1 = 123
8+
N2 = 987
9+
10+
print(solution(N1))
11+
print(solution(N2))

0 commit comments

Comments
 (0)