Created
March 2, 2021 12:59
-
-
Save ofelix03/66168817055d315d19df384f7507f600 to your computer and use it in GitHub Desktop.
String Concatenation using %-formatting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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