Hi,
I have this input
I have this input
P (0, 2,+1) (2, 0, -1) (0, 4,+1) (4, 0, -1)and I would like to have it printed out this way
[(0, 2, 1), (2, 0, -1), (0, 4, 1), (4, 0, -1)]. However, due to the extra space in the input I ran into this error. Without making any change to the input, I wonder if anyone could advise? Thanks
algorithm_type_2 = list(eval(user_input_2)) File "<string>", line 1 (0,,2,+1),(2,,0,,-1),(0,,4,+1),(4,,0,,-1) ^ SyntaxError: invalid syntax
user_input = input().split() # input_list = user_input.split() # algorithm_type = 'X' algorithm_type = user_input.pop(0) user_input_2 = ','.join(user_input) algorithm_type_2 = list(eval(user_input_2)) print(user_input_2) print(algorithm_type_2)