From the course: Python: Decorators

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Challenge: Decorators with arguments

Challenge: Decorators with arguments - Python Tutorial

From the course: Python: Decorators

Start my 1-month free trial

Challenge: Decorators with arguments

(upbeat music) - [Instructor] So for this challenge write a decorator called munch that replaces the characters from the string Fibonacci with X so it munches away at the string. Hence the name. It takes the start and end arguments. Both of these need to be integers that defines the range of characters to be replaced with X. So the start and the end work like the Python in-built function, range. So start is inclusive and end is exclusive. So for example, if we pass arguments one and four, we'll get the following output. And with the arguments zero and 10, we'll just get nine Xs. And that's because we're replacing or munching away at all the nine characters of the string Fibonacci. Use munch.py as your starting point. This challenge should take you about 10 minutes.

Contents