Python Forum
not able to complete a project - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: not able to complete a project (/thread-11223.html)

Pages: 1 2


RE: not able to complete a project - olmin - Jun-30-2018

(Jun-30-2018, 10:09 AM)j.crater Wrote: using "binary search"
I've only come across the jargon like if-else, elif and while loop so I created the program with the functions I know.

Python programming for the absolute beginner is a good book, right??

By the way thanks to you all for helping me.


RE: not able to complete a project - ichabod801 - Jun-30-2018

Binary search is about dividing the search space in half. So you start at the middle (25). Say the response is that you're too low. You now know the answer is in the range 26 to 50. So you go to the middle of that range. Each round you adjust the high and low of the possible range based on the response, and guess the middle of the range.