How can I get atom to show true/false when running a condition


#1

Sorry if this is an easy one but I did some Googling before I posted this.

I just started programming and I am using Atom as a text editor/IDE for Python (might not be the best idea but that’s a separate discussion).

I wrote a couple simple statements, and when I run them, they work, great, no errors. But, I want Python to tell me if the condition is true or false.

For example, this is what I expect to see

a = [1, 2, 3]
b = a
b is a
True

b == a
True

b = a[:]
b is a
False

b == a
True

However, True/false never appears. It just works or doesn’t work, but it always works, regardless of whether true or false is met.


#2

Is it possible that what I am asking is simply an impossibility? Perhaps, I need to write “if b =a, print(b)”


#3

If you want to see how an expression evaluates, just write print(a == b).


#4

Thanks, that’s simple. I thought each one would evaluate without the need to enter print, guess I was wrong


#5

They do evaluate, but you don’t want to receive messages about every if in your program unless you’re running a test suite. print() says, “Evaluate this expression and direct the results toward the user.”


#6

@liveod: What you ask looks like an exercise / practice.
Would you not want to do those in the terminal instead?
image