#### Category : tuples

l=[(A,B),(A,C),(E,F)] Where A is equal to B and A is equal to C and E is equal to F. I need to group the elements equal to each other in the same tuple. result=[(A,B,C),(E,F)] How can i do that? Source: Python..

u_list = input("put numbers: right now: ") List = u_list.split(",") t = tuple(List) print("Tuple: ",t) print("list: ",List) why do you need a comma in front of the variable: t variable: List? I mean the one where there is ,t – comma in front of the t . Source: Python-3x..

I’ve managed to adjust color when cursor hovers over a tkinter canvas rounded rectangle button using this: def shade_rgb(rgb): """ Adjust shade of rgb by 25% (value 64 out of 256) :param rgb: tuple of red, green, blue integers 0 to 255 :returns: tuple of red, green, blue integers 0 to 255 """ converted = ..

(‘word1’, ‘word2’) If I have a tuple, how can I add all of the words in the tuple into one string? Desired output: word1 word2 Source: Python..

There is list of list of tuples: [[(0, 0.5), (1, 0.6)], [(4, 0.01), (5, 0.005), (6, 0.002)], [(1,0.7)]] I need to get matrix X x Y: x = num of sublists y = max among second eleme throught all pairs elem[x,y] = second elem for x sublist if first elem==Y 0 1 2 3 4 ..

input file: 1 2 3 4 5 what I have at this time: filename=input("Please enter the filename or path: ") with open(filename, ‘r’) as file: filecontents=tuple(map(int, file.read().split())) print(filecontents) output: (1,2,3,4,5) intended output: 1 2 3 4 5 Source: Python..

I have the following variable: data = [([‘a’, ‘b’, ‘3’], [‘c’, ‘a’, ‘r’]), ([‘*’, ‘[‘, ‘e’], [’33’, ‘gh’, ‘ew’]), ([’23^’, ‘re#’, ‘4\$’], [‘tr’, ‘fF’, ‘5%’])] I want to write data into a CSV file as follows: a c b a 3 r * 33 [ gh e ew 23^ tr re# fF 4\$ 5% Note ..