Invitation to Computer Science 8th Edition

Published by Cengage Learning
ISBN 10: 1337561916
ISBN 13: 978-1-33756-191-4

Chapter 9 - Challenge Work - Page 477: 1

Answer

See explanation

Work Step by Step

Below there is the python code for sequential searching the target number. n=int(input("How many numbers are in the list: ")) data=[] i=0 number=int(input("Enter first number: ")) data.append(number) while i < n-1: $\quad$number=int(input("Enter next number: ")) $\quad$data.append(number) $\quad$i+=1 target=int(input("Enter target number: )) found=False for i in a: $\quad$if i==target: $\quad$$\quad$found=True $\quad$$\quad$break if found: $\quad$print("Successful search, the value is in the list") $\quad$print("Unsuccessful search, the value is not in the list")
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.