I have created a sample list of list1 = ["a", "b", "c", "d"]. I would like to create a new list with a loop, in which the items from list1 would be saved, connected with an https link. In list2, the items in the list would look like this: "https://www.google.com/a", "https://www.google.com/b" …. How to do is in python3?
>Solution :
You can do:
base_url = 'https://www.google.com/'
list1 = ["a", "b", "c", "d"]
list2 = [f"{base_url}{item}" for item in list1]