[問題] 用函數找尋list中的值
array = [1111,2222,3333,4444,5555,6666]
def search(input):
for item in array:
if input == item:
print "bingo"
else:
print "not yet"
while True:
keyin = raw_input()
print search(keyin)
------------
原本預期鍵入 2222 會產生
not yet
bingo
not yet
not yet
not yet
not yet
但是卻產生
not yet
not yet
not yet
not yet
not yet
not yet
None
不知道是哪裡出問題..?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.116.1.134
推
07/01 14:08, , 1F
07/01 14:08, 1F
→
07/01 14:09, , 2F
07/01 14:09, 2F
→
07/01 14:25, , 3F
07/01 14:25, 3F
推
07/02 10:19, , 4F
07/02 10:19, 4F
→
07/03 08:07, , 5F
07/03 08:07, 5F
→
07/03 11:20, , 6F
07/03 11:20, 6F