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!

45 out of 46 users completed this Bite.
Will you be Pythonista #46 to crack this Bite?
Average Bite difficulty 1-10 rating: 1.5
» You can do it! 😌

Github login button
We use Python 3.7