Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I don't understand how to type the answer

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading