File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments