Strings

Function with Choices


Write a function that concatenates and prints:

The ultimate answer to the ultimate question of life, the universe, and everything is: XXX.

Where XXX is either a string or a number that is passed to the function as a parameter. Use this function to print out the answer if the input parameter is 42, but don’t actually do the printing from inside the function (think about why printing from outside the function might generally be more useful).

If you don’t understand why this question is fun/funny you can Google it or, better yet, actually read Hitchhiker’s Guide to the Galaxy, which is one of the funniest books ever written. There is also a very valuable programming lesson to this story.

[click here for output]