Write a function named satisfaction that has 1 input (parameter). This parameter’s value will be a string. The function should return the parameter’s value concatenated with a space and then "beast".
i tried to do
def satisfaction (x) :
x = '' + "beast"
return x
That didn’t work or maybe I am typing it in wrong. I don’t understand what to do here.
This is one sample test case :
satisfaction("real"), evaluates to "real beast"
>Solution :
What you were doing wrong:
You were simply assigning "beast" to x. Also, '' this doesn’t include space. To add a space use ' '
def satisfaction (x) :
x = '' + "beast"
return x # You are returning x outside the function.
This is how it should be done:
The x parameter is the input that you need to concatenate with beast.
def satisfaction(x):
return x + ' beast' # This returns input parameter with space, concatenated with beast.