Let's say I have the following list in Python:
values = [sku1, sku2, sku3, sku4, sku5]
Based on list's length, I need to add each value from the list to a link. For example if the list has 1 item, my link should be:
link = 'https://google.com/' + values[0]
If the list has 2 items, my link should be:
link = 'https://google.com' + values[0] + values[1]
..and so on.
I've tried doing this with:
if len(values) == 1:
link = 'https://google.com/' + values[0]
if len(values) == 2:
link = 'https://google.com' + values[0] + values[1]
But the input list can have any number of items so using so many ifs doesn't seem ok. Is there any other way of doing this?