The Big If + Other questions


#1

Hey there, I've already completed the lesson but I want more insight in the matter.

The question they're asking us is...

Make sure that the_flying_circus() returns True
def the_flying_circus():
if ________: # Start coding here!

Don't forget to indent

the code inside this block!

elif ________:

Keep going here.

You'll want to add the else statement, too!

Now my first question is... Can you give me an example using "not, and, or"? (All of them ^^)

Second question: If I wanted to use print do I use it after my return or before it?

Last question is: Take this for example: (3 < 4) and (5 >= 5) why are they in brackets? Can't we just type them without the brackets? Thank you very much.


#2

you already have a and example?

(3 < 4) and (5 >= 5)

you can also use or:

(3 < 4) or (5 >= 5)

or not:

(3 < 4) or not (5 >= 5)

before obviously, a function ends the moment a return keyword is reached

yes, without brackets should work fine. I don't know why certain people prefer to use brackets


#3

Thanks for answering the last 2 questions. There are 2 questions now that popped up in my head.

The first one:

Take this for example

(3 < 4) or not (5 >= 5)

What does or not do in that situation?

Second question:

Is it actually possible to use not, and and or in one statement?

Thanks!


#4

5 >= 5 is true, agree? not will make true false and false true. not is not related to or, you could have:

if not True:

which is false. or and not do not have to be used together. Not simple reverse the conditions.

Yep, you can. Then brackets might be useful. like so:

if True or (not False and True):

#5

Oh I see! That cleared things up! Thanks for explaining!