CBSE Class 11 Computer Science Question 167 of 173

Data Handling — Question 19

Back to all questions
19
Question

Question 19

Write a program that inputs a string and then prints it equal to number of times its length, e.g.,

Enter string : "eka"
Result ekaekaeka

Solution
str = input("Enter string: ")
len = len(str)
opStr = str * len
print("Result", opStr)
Output
Enter string: eka
Result ekaekaeka
Answer