And Or Not


#1


https://www.codecademy.com/en/courses/python-beginner-BxUFN/2/6?curriculum_id=4f89dab3d788890003000096


i have no code yet because i hove no actual idea what im doing and i really need help i almost just need the answers just to get on with the python lessons


#2

@xxserpentsxxyt Hey there again! Always just knowing the answer to something isn't ideal, you also need to know why it is how it is. The exercise you are on is asking you make each of the booleans false or true based on the and, or , and not operators.

  • And operators return anything as false, unless both sides of the operator is true (aka, if they are this: True and True)

  • Or operators do the exact opposite and return true always unless both sides of the operator are false.

  • Not operators basically do the exact opposite of what they are told. ( not True == False)

Here are a few examples for you to get started with:

# Make me true!
bool_two = (2==2) or "Hi" == "Bye"

# Make me false!
bool_three = "Loser"=="My Family" and 1 + 1 == 2

# Make me true!
bool_four = not False

Hope that help! Let me know if you are still struggling. Good luck and happy coding! :slight_smile:

-- @chipjumper36731


#3

Your right just knowing the answer to something isn't ideal but a lot of the time if I get the answer I realize what I did wrong and can remember it from this situation. Thank you for the example I will finish this lesson now but i'm lost on a few Else and Return statements so you might end up hearing from me again. Sorry i've been so completely and udderly lost in some of the lessons but a few the hints are the same thing as the instruction or things like the instructions not telling me how I understand which is partially just my fault but some things I just don't understand as well as other the same for everybody else. I do enjoy coding though and I hope to continue learning and working through the early, middle and later stages of Python!


#4

@xxserpentsxxyt Your fine! We all get a bit frustrated sometimes :slight_smile:. And I agree with you:

As you can see from my examples making the bools don't have to be super intricate and hard, they can be pretty simple. As for the else and return statement problems, you can tag me in a new topic, and I'll see what I can do to help.

-- @chipjumper36731


#5

Thank you. you will probably be getting that soon I think I just may be thinking wrong xD


#6

Expression? Else Returns and False

I was not able to make another topic because of the daily limit so I have put it here I hope you can still help!

As you can see I have not made much headway because I am confused
weather to use expressions I think I am right with where I put the False
and the no spaces I put between it because of the semi colon :

@chipjumper36731

answer = "'Tis but a scratch!"

def black_knight():
if answer == "'Tis but a scratch!":
return True
else:False
return 16 < 3 # Make sure this returns False

def french_soldier():
if answer == "Go away, or I shall taunt you a second time!":
return True
else:False
return 16 < 3 # Make sure this returns False


#7

Alright what exercise is this? Can you provide a link?


#8

Oh yes I forgot sorry!
https://www.codecademy.com/en/courses/python-beginner-BxUFN/3/3?curriculum_id=4f89dab3d788890003000096


#9

Okay, there are a couple of problems in here:

def black_knight():
    if answer == "'Tis but a scratch!":
        return True
    else:False 
        return 16 < 3 # Make sure this returns False

def french_soldier():
    if answer == "Go away, or I shall taunt you a second time!":
        return True
    else:False 
        return 16 < 3 # Make sure this returns False

First, you forgot to tab for your else statements. Also you just have to return "false" not make an equation that equals false, so both of your else statements should look like this:

else:             
        return False       # Make sure this returns False

That should fix things. And I don't think you made an actual mistake other than misunderstanding the directions. :slight_smile:

-- @chipjumper36731


#10

Ultimately your code should look like this:

answer = "'Tis but a scratch!"

def black_knight():
    if answer == "'Tis but a scratch!":
        return True
    else:             
        return False       # Make sure this returns False

def french_soldier():
    if answer == "Go away, or I shall taunt you a second time!":
        return True
    else:             
        return False       # Make sure this returns False

#11

I think i used literally a few not enough spaces....
Thank you for helping me with everything that I've been working on I do want to continue with this.
By the way what lessons are you working on?


#12

Do you know anywhere to execute Python commands into a console box because on the python website the commands aren't working the same as on here and I don't know where they end up executing


#13

I'm on the last one :slight_smile:


#14

There is Codecademy Labs for that, I’ll post the link here:

labs repl.it


#15

....how long it take xD


#16

Ty i've been looking for this for a while but i didn't know codeacademy had a lab or console tester


#17

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