[Tutor] Python programming question related to Return/Print statement
Mats Wichmann
mats at wichmann.us
Fri Aug 14 14:53:22 EDT 2020
On 8/14/20 11:45 AM, eric grunfeld wrote:
> Good Afternoon Everyone:
>
> I have been seeking to rectify my mistake in running this program via
> Python.
>
> Here it is:
>
> def format_name(first_name, last_name):
> return "Name " + first_name + ", " + last_name
> return string
the second statement will never be reached, so drop it.
> However, after running the program, this has been the response:
> Incorrect
>
> Not quite, format_name('Ernest', 'Hemingway') returned Name
> Ernest, Hemingway, should be Name: Hemingway, Ernest.
>
> It appears to be how I have programmed my return statement.
it seems whatever grading tool you're entering this into is expecting a
colon after the word Name, so you should include that when you construct
the string.... it's possible from what you pasted that it also expected
a terminating period.
So it appears a question of reading the problem specification very
precisely.
More information about the Tutor
mailing list