GH avatar Bite 133. Convert an Amazon URL into an affiliation link

Can you help PyBites automate their Amazon affiliation link creation?

Complete the generate_affiliation_link(url) function below which should convert the following links:

... into the following affiliation links respectively:

Hint: regex might be overkill here! Have fun and remember, keep calm and code in Python!

go back Beginner level
Bitecoin 2X

Will you be Pythonista #140 to crack this Bite?
Resolution time: ~35 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 1.4 on a 1-10 difficulty scale.
» You can do it! 😌

Buy Now Login and get coding
We use Python 3.7