String made of 4 copies of last 2 characters

In this program, we will take a string as input and get a string made of 4 copies of last 2 characters

Steps to solve the program
  1. Take a string as input.
  2. Select the last 2 characters from the string using indexing.
  3. Multiply them by 4 to get 4 copies.
  4. Print the output
				
					#Input string
string = "Sqatools"

#printing output
print(string[-2:]*4)
				
			

Output :

				
					lslslsls
				
			

list of strings and returns the length of the longest string.

reverse a string if it’s length is a multiple of 4.

Leave a Comment