GEOG 485:
GIS Programming and Software Development

Lesson 1 Practice Exercise 2 Solution

PrintPrint

Solution:

first = "James"
last = "Franklin"
full = first + " " + last

print (full)

Explanation:

In this script, two string variables are used to hold the two name pieces. The two pieces are merged together using the concatenation character (+ in Python). A space is inserted between them using a space within quotes. 

If you wanted to display the name pieces last name first and with a comma in between, you would change the 'full' statement as follows:

full = last + ", " + first