[Tutor] Python programming question related to Return/Print statement

Alan Gauld alan.gauld at yahoo.co.uk
Fri Aug 14 16:34:42 EDT 2020


On 14/08/2020 18:45, eric grunfeld wrote:

> def format_name(first_name, last_name):
>     return "Name " + first_name + ", " + last_name
>     return string
> 
> print(format_name("Ernest", "Hemingway"))
> # Should return the string "Name: Hemingway, Ernest"

Look closely at the order of those names.

> 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.

Its also looking for a colon after Name. So you have two errors to fix.
Computers are fussy, you'll need to get used to that if you want
to be a programmer.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list