728x90
반응형

수행 코드

dataSource = [12,10,25,5,7,96]

indexValue = 0
toSearchValue = 10

sizeData = len( dataSource )
#print("sizeData =", sizeData )

while( indexValue < sizeData ):
    if( dataSource[indexValue] == toSearchValue ):
        print("탐색 성공 at" , indexValue, "index" )
        break
    indexValue += 1

if(indexValue == sizeData ):
    print( toSearchValue, "를 찾지 못함")
print("Done", flush=True)

 

 

수행결과

PS D:\PythonCode> python .\LinearSeach.py
탐색 성공 at 1 index
Done
PS D:\PythonCode>
728x90
반응형

+ Recent posts