[Solved] Python, take value of a list from an input


# Note that variable names cannot contain hyphens
flag_list = ["--syn","--ack","--push","--fin","--urg","--rst"]

# This clearly has to be in quotes
user_input = raw_input("Enter numbers separated by comma:" )

# Split the user input string at the commas, and turn each element into an integer.
flag_nums = map(int, flag_num.split(','))

# List indexes start at 0, so subtract 1.
# Use brackets to access the Nth item in the list.
# This is a list comprehension.
flags = [flag_list[n - 1] for n in flag_nums]

2

solved Python, take value of a list from an input