76.6k views
5 votes
Suppose your name was Alan Turing. Write a statement that would print your last name, followed by a comma, followed by a space and your first name.

1 Answer

4 votes

Answer:

def name_string( name ):

user_name = name

split_name = user_name.split(" ")

list( split_name )

print ( split_name[ 1 ], ", ", split_name[ 0 ] )

# the test should print out " Turing, Alan"

name_string ( " Alan Turing " )

Step-by-step explanation:

The python function above should print out the reverse of a name and surname and separated by a comma.

User Shakiara
by
5.9k points