You are currently viewing How to append a some characters in a string in Python

In this article, we will take inputs from the user and will append that characters or strings entered by users to the existing string. This is a practice program under our Python practice programs seriese. In this example code, we will take input from the user and will append the text ing at the end.

# Take input from user & print string + ing
String = input("enter a String: ")
count = 0

for x in String:
    if 48<=ord(x)<=57:
        count = 1
        break
if count ==0:
    print(String+'ing')
else:
    print(" not a proper String")

The output of the above code below

In the code above I have appended the text at the end, you can also modify the above code to prepend some text in front of the text.

That’s it Folks on this topic. Let us know your comments on this article in the comment box below. Kindly like our facebook page, follows us on twitter and subscribe to our YouTube channel for latest updates.

Leave a Reply