如題 測資是string 型態 的 input嗎?
還是是list的型態
再麻煩多解釋一下了
我的python code是這樣
可是當我把我最底下的a 改成
a = input()後 會一直有error
----------------------------
def hero(data):
nums = data.split('\n')
T = nums[0]
del nums[0]
for i in range(int(T)):
N,M = nums[0].split()
del nums[0]
N = int(N)
b = nums[0:N]
rev_nums = b[::-1]
for i in range(len(rev_nums)):
if type(rev_nums[i]) != int:
x = rev_nums[i]
rev_nums[i] = x[::-1]
while b != rev_nums:
print ('keep defending')
break
else:
print('go forward')
for i in b:
nums.remove(i)
a = '2\n3 3\n1 1 0\n0 1 0\n0 1 1\n1 5\n0 0 1 0 1'
hero(a)