copper
copper

Reputation: 693

Conditionals and bisection search. (for python.)

I'm a beginner in programming and I have a two basic question. The first concerns conditionals. If I have an if and else statement and the condition is met for the "if" statement, when it's finished with the if, the program will skip the else statement, right ? (Just to be sure.)

Second question concerns the use of bisection search. I went on Wikipedia and saw that it's main concern was with finding the zeros of polynomials. Well, if I'm not using it on polynomials, but to find the smallest sum of money to pay off a debt in a year with a minimal bound and maximal bound established (with interests,etc.)

The question is the following: Is the use of bisection search, in my context, only taking the average? Is there anything else than using an average? If this isn't clear, I'll give you the following link Lecture 4: Machine Interpretation of a Program.

Go see the problem number 3 and you'll understand better. If there's anything you need to know, tell me.

(By the way, I'm working with Python.)

Upvotes: 0

Views: 149

Answers (1)

henrebotha
henrebotha

Reputation: 1298

You should read the Python documentation. There's a very good tutorial included in it.

For your first question: yes, else only executes if the if condition was not met.

For the second question: that's more of a maths question than a programming question, and I'm not qualified to answer it, but I'd be willing to bet the problem asks you to use bisection search because it's not the same as just taking an average.

Upvotes: 1

Related Questions