Python Program to Copy String

« Previous Program Next Program »

Copy String in Python

To copy string in python, you have to ask from user to enter a string and then copy that string into another string variable and finally print the value of that string variable as shown in the program given here.

Python Programming Code to Copy String

Following python program ask from user to enter a string to copy that string:

# Python Program - Copy String
while True:
	print("Enter 'x' for exit.")
	string = input("Enter any string: ")
	if string == 'x':
		print("Copying string1 into string2...")
		cstring = string
		print("String 2 after successfully copied..!!")

Here is the sample run of the above Python program illustrating how to copy string:

python copy string

Same Program in Other Languages

You may also like to learn or practice the same program in other popular programming languages:

« Previous Program Next Program »


Quick Links
Signup - Login - Give Online Test