17/19 i got the answer don't listen to the other person he doesn't tell you to tab the strings


#1

def shut_down(s):
return s == 'yes'

if shut_down == 'yes':
print("Shutting Down")

elif shut_down == 'no':
print("Shutdown terminated")

else:
print("Sorry")

there you go that's the actual answer don't copy this part otherwise it's obv wrong lol.

INCORRECT IDIOT: https://www.codecademy.com/forum_questions/54e4e973937676f95f003be3
IM SENIOR CODER BRO


#2

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I AGREE I GOT THE CODE WRONG FROM THIS GUY (https://www.codecademy.com/forum_questions/54e4e973937676f95f003be3) DONT USE HIS ANSWER.
THANKS FOR THE CORRECT ANSWER!!!!!!!!


#3

yes bro!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


#4

HI @bitsolver34340,

Pardon me, but I am pretty new to coding and I have some questions to ask regarding your code:

1.. Why does your function return this:

2.. Is print the same as return? Because I saw that the instructions actually said to return....

I saw that your proposed code can pass the exercise so I am quite curious...


#5

A print statement displays the standard value of a parameter but a return statement sends the parameter to its caller. i.e (the function name)


#6

@bandit That's what I thought too, so I am curious as to why that code works


#7

What part of that code do you think might pose an error?


#8
  1. why we have a return s == 'yes' bit, like what is this supposed to mean?

  2. Why shut_down can be used as a parameter and whether shut_down can ever == 'yes' or 'no'.


#9

Okay, so every string you need to press TAB
Example:
def shut_down(s):
return s == 'yes'
I used space you can't replicate the function out of code.However, in the coding interface press (TAB)


#10

The code above will not function when called I tried it.

if you call

shut_down('yes)
or
shut_down('no')

It will in fact give an error or Boolean False.