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.

30th Nov 2017, 6:51 AM
Wiz
Wiz - avatar
3 odpowiedzi
+ 6
Show it on code playground please!
30th Nov 2017, 7:18 AM
Oma Falk
Oma Falk - avatar
+ 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.
30th Nov 2017, 7:20 AM
ChaoticDawg
ChaoticDawg - avatar
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
30th Nov 2017, 6:53 AM
Wiz
Wiz - avatar