Python If, Else, Elif Statements Fundamentals

I’m stuck at this screen. How do i go about this. This is how i did it (picture below). I can’t erase the “true/false” from the already stored codes. Help​:hot_face::hot_face::hot_face:

Hi @kontorboampongjr, can you post the screen’s link so we can understand the context better?

Below is the link @OlutokiJohn ;

Do i have to code the correct statements again or I should change the boolean in the stored codes?

yes just change it.

let me break it down for you this way;
In the code editor, three pairs of statements were provided for use in the exercise. the indented code only executes when True follows if. When False follows if, the code inside the body doesn’t execute. so you were told to leverage on this behaviour to only print the statements where both statements are true of which only the second if statement is correct i.e the sky is blue and 5 is indeed greater than 3 so since you know that if false statement won’t execute you were told to change the true to false where the statement in the print function is false.

I hope you understand this and if not let me know.

I understand it. My issue is how do I change the “True or False.” How do i have to erase the “true” and type “false” in the codes given in the editor.

just change true to false where you think the statement in the print function isn’t right

Yes i understand. I can’t erase even the “true” or “false” in the code editor to type tbe right boolean statement. Kindly check the screen shot below;

in the code editor:

if False:
print(“2 + 2 == 5”)
print(“lemons are sour”)

if True:
print(“the sky is blue”)
print(“5 >= 3”)

if False:
print(“spheres have corners”)
print(“7 / 5 == 2”)

Try copy and paste this into the editor

I did that but still i get the same message; " The output is not what we expected.". Is there a way i change what is already given in the code editor so that i change True/False statement.

Hi @kontorboampongjr,

  1. Please first clean your screen removing all the code from it.
  2. Next, copy-paste the following code suggested by John:
if False:
    print("2 + 2 == 5")
    print("lemons are sour")

if True:
    print("the sky is blue")
    print("5 >= 3")
if False:
    print("spheres have corners")
    print("7 / 5 == 2")

Does it work now?

oh hi @Elena_Kosourova, what markdown were you able to use to be able to give space to the print function?

Hi @OlutokiJohn, I just included the whole block of my code lines into three backticks (```) and inside the block, I added 4 spaces before each print statement.

Yes it does.

Thanks very much!

1 Like

Alright thank you very much

1 Like