SimeonTs

SUPyF2 Functions-Lab - 03. Repeat String

Oct 8th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. """
  2. Functions - Lab
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1727#2
  4.  
  5. SUPyF2 Functions-Lab - 03. Repeat String
  6.  
  7. Problem:
  8. Write a function that receives a string and a repeat count n.
  9. The function should return a new string (the old one repeated n times).
  10.  
  11. Examples:
  12. Input:      Output:
  13.  
  14. abc
  15. 3           abcabcabc
  16.  
  17. String
  18. 2           StringString
  19. """
  20.  
  21.  
  22. def repeat(string, times):
  23.     return string * times
  24.  
  25.  
  26. print(repeat(input(), int(input())))
Add Comment
Please, Sign In to add comment