8000 programmers · KanuKim97/Algorithm@83b7039 · GitHub
[go: up one dir, main page]

Skip to content

Commit 83b7039

Browse files
committed
programmers
1 parent aa1e0b1 commit 83b7039

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

Programmers/level0/OX퀴즈.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def solution(quiz):
2+
answer = []
3+
4+
for i in range(len(quiz)):
5+
str1 = list(quiz[i])
6+
if int(eval(''.join(list(str1)[:list(str1).index('=')]))) == int(''.join(list(str1)[list(str1).index('=')+1:])):
7+
answer.append('O')
8+
else :
9+
answer.append('X')
10+
11+
return answer
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def solution(keyinput, board):
2+
row_max = (board[0]-1)//2
3+
col_max = (board[1]-1)//2
4+
start = [0,0]
5+
6+
for i in range(len(keyinput)):
7+
if keyinput[i] == "left" and start[0]-1 >= -(row_max):
8+
start[0] -= 1
9+
if keyinput[i] == "right" and start[0]+1 <= row_max:
10+
start[0] += 1
11+
if keyinput[i] == "up" and start[1]+1 <= col_max:
12+
start[1] += 1
13+
if keyinput[i] == "down" and start[1]-1 >= -(col_max):
14+
start[1] -= 1
15+
16+
return start

0 commit comments

Comments
 (0)
0