Dec-17-2020, 03:44 PM
Here's some code:
If I leave the asterisk out, the result of the last line is "['Black', 'White']
What happened to White when I tried to unpack the list?
Thanks!
print() print('This program will print out a set containing all colors from color_list_1 {"White", "Black", "Red"} that are not present in color_list_2 {"Red", "Green"}.') color_list_1 = set(["White", "Black", "Red"]) color_list_2 = set(["Red", "Green"]) print() print('Colors meeting stated criteria are {}.'.format(*[i for i in color_list_1 if i not in color_list_2]))The result of the last line is "Black"
If I leave the asterisk out, the result of the last line is "['Black', 'White']
What happened to White when I tried to unpack the list?
Thanks!