Skip to content

Commit e623641

Browse files
authored
Add files via upload
1 parent 10f3b5c commit e623641

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

Day14/DistanceOfX.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
def solution(x, n):
2+
answer = []
3+
for i in range(n):
4+
answer.append(x*(i+1))
5+
return answer
6+
7+
x1 = 2
8+
x2 = 4
9+
x3 = -4
10+
11+
n1 = 5
12+
n2 = 3
13+
n3 = 2
14+
15+
print(solution(x1, n1))
16+
print(solution(x2, n2))
17+
print(solution(x3, n3))

Day14/HidingPhoneNumber.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def solution(phone_number):
2+
answer = '*' * (len(phone_number)-4) + phone_number[-4:]
3+
return answer
4+
5+
phone_number1 = "01033334444"
6+
phone_number2 = "027778888"
7+
8+
print(solution(phone_number1))
9+
print(solution(phone_number2))

Day14/Matrix.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def solution(arr1, arr2):
2+
for i in range(len(arr1)):
3+
for j in range(len(arr1[i])):
4+
arr1[i][j] += arr2[i][j]
5+
6+
return arr1
7+
8+
arr1 = [[1,2],[2,3]]
9+
arr2 = [[1],[2]]
10+
arr3 = [[3,4],[5,6]]
11+
arr4 = [[3],[4]]
12+
13+
print(solution(arr1, arr3))
14+
print(solution(arr2, arr4))
15+

0 commit comments

Comments
 (0)