Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

duplicate a list with for loop in python

her_clothes = ["women's trousers", "women's shirts", "women's shoes", "women's sunglasses"]
his_clothes = []

for clothes in her_clothes:
    his_clothes.append(clothes.replace("women's", "men's"))

print(his_clothes)

# output - ["men's trousers", "men's shirts", "men's shoes", "men's sunglasses"]
 
PREVIOUS NEXT
Tagged: #duplicate #list #loop #python
ADD COMMENT
Topic
Name
5+2 =