Functions 17. Review: Functions


Exercise, where I stuck:

Oops, try again. Your code looks a bit off. Feel free to peek back at earlier exercises if you need a refresher! Your code threw the following error: invalid syntax (python, line 4)

What i expect to happen:
I expect that programm will ask me "Enter Yes or No", then I print "Yes", and programm will print(or return, whatever) "shutting down"

def shut_down(s):
    rawinput("Enter Yes or No")
    s = rawinput
    if s = "Yes":
        return "Shutting down"
    elif s = "No":
        return "Shutdown aboted"
        return "Sorry"


to check if a number is divisible by 3 check if the remainder equals zero. To calculate the remainder use the modulo operator (%)


Thank You, my bad. Now I have another problem.


if you want to prompt the user for input, do this outside the function, store the result of this prompt in a variable and pass this variable as argument when calling the function

a single equal sign means assign

If you need more help, make a new topic since this is a question for a different exercise