0
How can I get my code to loop properly?
I'm taking an online class with a non-existent teacher and no discussion board. the assignment is: design a modular program to perform a binary search. your program should initialize an unsorted list(using list provided), display the unsorted list, sort the list and display the sorted list. the program should then set up a loop to ask the user for a name, perform a binary search, and then report if the name is in the list. use a sentinel value to end the loop. I got everything except the loop to work.
3 Answers
+ 6
Show it on code playground please!
+ 1
By saying you got everything except the loop to work, I'll assume your including the code that goes int the loop. (getting input, binary search, etc)
A sentinel value is just some arbitrary value such as -1 or q or -99 etc.
inp = ''
while inp != 'q':
inp = input()
...
...
This will loop until the user inputs q.
0
I know no one want to help with homework, but I have no option. I will learn from anything someone tells me, because the class isn't teaching me anything. the only reason I got this far is because of this app