How to separate an input on python into different lists? -
i have code in require 3 different inputs put separate lists. have 3 lists set up:
a = [] b = [] c = [] i have 3 different inputs, 1 each list, , wish combine these inputs 1 input, separating each factor of comma or semicolon.
for example:
apple,365,rope using python, how separate each factor in input can put different lists?
i have tried searching how separate using input has not worked not know input be.
a = [] b = [] c = [] # if string your_input = "apple,365,rope" your_input = your_input.split(",") = [your_input[0]] b = [your_input[1]] c = [your_input[2]] print a, b, c # if tuple your_input = ("apple", "365" , "rope") = [your_input[0]] b = [your_input[1]] c = [your_input[2]] print a, b, c
Comments
Post a Comment