Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ofelix03/66168817055d315d19df384f7507f600 to your computer and use it in GitHub Desktop.
Save ofelix03/66168817055d315d19df384f7507f600 to your computer and use it in GitHub Desktop.
String Concatenation using %-formatting
# Concatenation involving %-formatting strings
str_1 = "This is %s %s" %(first_name, last_name)
str_2 = "He is a %s. " % (profession)
str_3 = "He is from Ghana"
# Concatenating str_1, str_2 and str_3 using the plus(+) sign
str_4 = str_1 + str2 + str_3
print(str_4) # Result: This is Felix Otoo. He is a Software Engineer. He is from Ghana"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment