Dupticate Unique Items of Lİst

Hey community.
I couldn’t manage to copy single ones and create new. i need a result like this:
80 80
80 80
60 50
80 80
80 80
60 50
ACtually my goal is being flexible .I mean in my case there 2 types. it can be 100 different values.
dplct

1 Like

@arincakkin

do you look for something like this

import copy

values = IN[0]

output = []

for i in values:
    c = copy.copy(i)
    output.append(c)
    
OUT = output

Yes thank you. i found somethinh bt ChatGPT Like this. This code also finds the results im looking for.

Input: a list of string values

input_list = IN[0]

Initialize the output list

output_list =

Iterate through the input list

for item in input_list:
# Ensure each item is a string
if isinstance(item, list):
item = " ".join(map(str, item)) # Convert list to string

# Split the string by spaces to check how many values it contains
values = item.split(" ")

if len(values) == 1:  # Single value
    # Duplicate the value and combine into a single string
    output_list.append(f"{item} {item}")
else:  # Multiple values
    # Keep the original string unchanged
    output_list.append(item)

Output the final list

OUT = output_list

1 Like
# 0️⃣Input: a list of string values

input_list = IN[0]
# 1️⃣ Initialize the output list

output_list = []
# 2️⃣ Iterate through the input list

for item in input_list:
# 3️⃣ Ensure each item is a string
if isinstance(item, list):
item = " ".join(map(str, item)) # Convert list to string

# 3️⃣ Split the string by spaces to check how many values it contains
values = item.split(" ")

if len(values) == 1:  # Single value
    #  Duplicate the value and combine into a single string
    output_list.append(f"{item} {item}")
else:  # ‼ Multiple values
    #  Keep the original string unchanged
    output_list.append(item)

# ✅ Output the final list

OUT = output_list
1 Like

Thank you @Draxl_Andreas :pray: