FAQ: Recursion vs. Iteration - Coding Throwdown - Multiplication? Schmultiplication!

Is it more better to use a conditional expression for this or just not?

Okay, so why is it not good to use better in the context of this lesson to use this:

Edit:
It seems like it performs the same as this:

Wah? Dredge up a post from ten months ago and wake up an inactive user? That tells me I’ve been wasting my time. Happy coding.

One concludes you are not doing the reading on logical operators or you would by now know how they work. Get the points we’ve made above, or not, at your peril if you wish to embark on this discipline. So far, we’re not sure how committed you are.

The thing we carry away from any lesson is WHAT WE DO.

I understand logical operators but the trickier one doesn’t make sense that much.

Then bear down and keep working on these sorts of problems until they do make sense. Stop in your tracks and get this material down. One would be kidding themselves going forward while this is still confusing. It is confusing, until you get it. Stick with this. We’re here to sort out your examples with you.

Promise you’ll have that paper and pencil crafted solution nearby.

So what concept in logical operators should I practice to make it not confusing.

Great question, to begin with. Start by answering these questions…

  1. What is an AND operation between two or more operands?
  2. What is an OR operation between two or more operands?
  3. What is a NOT operation?

Draw the truth tables for each.

  1. Explain short-circuiting.

It gives us a way to combine two conditions into one conditional statement. All of the conditions have to be True for the whole condition to return True.

It lets us combine two conditions, which if at least one of the conditions are True then the whole condition will return True.

It reverses the boolean value of some data. True to False, False to True
I learnt this in the Learn Python 3 course.

You left out question 4.

As for the other three questions, all your answers are subjective, which means you still believe this is a design constraint. Logic is not something we design. It is what we design BY.

I thought there were only 3. How do you draw a truth table? I never learnt that.

Like a simple graph, all the values for A are one axis, and all the values for B are on the other. In a table, they make up the headings.

AND   0  1 < A 
   0  F  F
   1  F  T
   ^
   B

OR    0  1 < A 
   0  F  T
   1  T  T
   ^
   B

The fourth was the long answer question, usually found near the bottom of an exam, and usually worth a third of the mark. Explain short-circuiting.

So the headings are and, or and not.
What do you draw in the body of the headings?

I can’t explain because I don’t know what it means in Python.

It’s not a Python term. It’s a logic term. Look it up. Prove to us that you understand what you read on the subject.

Until now you have been placing heavy demands on the supports of the member community. We need some reciprocation. It’s not clear you are staying with one subject long enough to absorb it or actually gain from our efforts to help. This will be my last input on your questions until you can prove we are not wasting our time while you fritter away yours.

Short circuiting is the stoppage of execution of boolean operation if the boolean value of the expression is determined already.