LearnPy Hub
← Decorators problems
Hard

Type-Checking Decorator

Write expects(*types) that checks each positional argument's type and raises TypeError otherwise. Decorate repeat_text(s, n) with @expects(str, int). Read s and n; if n is not a whole number pass it as a string. Print the result or TypeError.

Input

Two lines.

Output

One line.

Sample 1

Input
ab
3
Output
ababab

Sample 2

Input
x
two
Output
TypeError
solution.py
Output appears here
Type-Checking Decorator · Python practice problem · LearnPy Hub