Mix and Match What variables did I miss


#1



I know I am missing something

10 mix and match


Oops, try again. Make sure you have a value for all 5 variables!


Replace this line with your code. 
# Use boolean expressions as appropriate on the lines below!

# Make me false!
bool_one = (2 <= 2) and "Alpha" == "Bravo"  # We did this one for you!

# Make me true!
bool_two = 7*8 == 56 or 3>5

# Make me false!
bool_three = 3-3 !=0 and 5/1 =2

# Make me true!
bool_four = not 3**2 + 4**2 != 5**2

# Make me true!
bool_five = 3 == 3 or 2==2


#2

Why are you assigning a value to a variable by using 'and'?

bool_three = 3-3 !=0 and 5/1 =2

That means two values, and one variable can't assign them. The code is fine if you just remove the equality sign and the product of it.

bool_three = 3-3 != 0 and 5 / 1

#3

thank you it worked

is there a place to read, study or learn more about this?
I am not understanding all of it.


#4

Actually you can't learn much more about booleans in Codecademy, but if you let me explain:
This exersice mixes up variables and booleans, and usually the booleans are used inside if- statements or for and while loops. As an example

if 10 > 1  and 1 < 2:
      print "10 is greater than 1 and 1 is smaller than two!" 

else:
      pass

Did you got it? At this example it checks if 10 is greater than 1 and 1 is smaller than 2.

if 10 > 1  or 3 < 2:
     print "10  is greater than 2 or 3 is smaller than two!" 

else:
     pass

This is another thing that you must know:
If one or the other statement is right, it gives you the output, whatever it is.

if 10 not in range(15):
     print "10 is not in the range of 15!"

else:
     pass

So we are at the third boolean. This code simply checks, if 10 is not in range of 15. If it isn't, the code prints that "10 is not in the range of 15." Using booleans in variables is possible, too, but using them in cases like this is MUCH more casual. Hope you got the idea. :slight_smile:


#5

that helps thanks, i'll keep plugging:relaxed:


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.