String Repetition in Python

String Repetition

You just need to take a string and a integer as an input from stdin and repeat the string up to the count given as in integer.
Input Format
You will be taking a string and an integer as an input from stdin.

Constraints
1 <= |S| <= 1000
1 <= N <= 100

Output Format
You need to print the string to the stdout.

Sample TestCase 1
Input
Hello
2
Output
HelloHello

Solution

import sys
def main():

# Write code here
ip1=raw_input()
val=input()
for i in range(0,val):
sys.stdout.write(ip1)

main()

Comments

Popular posts from this blog

Reasoning-Number Series

Reasoning-Letter Series

Profit and Loss