So the goal of this code is to print as many permutations as possible from a list of words in a text file. I save all these permutations as a list within a larger list. I am trying to loop through the larger list and print each smaller list as a string. For example if ..
I have an array, where I want a specific index to be merged. ["captain:", "robot", "alpha", "beta:", "gama", "delta:", "fighter", "test", "exp"] the idea of this, every even element should contain : and the rest of the elements should not contain : The output I want: ["captain:", "robot, alpha", "beta:", "gama", "delta:", "fighter, test, exp"] ..
Hey Guys i need your help. I just started programming in python and right now i try to learn threading in python. This is the task: Implements a function with two parameters: (i) an input list of numbers (int) and (ii) a Output list in which the numbers should be sorted. As long as there ..
I need to create a function that reads the data given and creates a list that contains tuples each of which has as its first element the name of the airport and as its second and third its geographical coordinates as float numbers. airport_data = """ Alexandroupoli 40.855869°N 25.956264°E Athens 37.936389°N 23.947222°E Chania 35.531667°N 24.149722°E ..
I have many python lists like this A,B,C,… A = [1,2,3,4,5] B = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’] The output I want is C = [[1, ‘a’], [2, ‘b’], [3, ‘c’], [4, ‘d’], [5, ‘e’]] The best thing that comes to my mind is C = [[i,k] for i,k in zip(A,B)] But I have many ..
I am trying to make a list that records every pressed key and adds it to a list but when I am trying to append it it only changes the last item to the last pressed key import keyboard Keys =  Keys.append(keyboard.read_key()) print(Keys) Source: Python..
I have 2 lists [A,B,C,D,E,F] – first list [X,X,X,X,X,X] – second list I would like to take last element of the first list and if there are any elements in the second list move them to the left and add the element as last. [A,B,C,D,E,F] [X,X,X,X,X,X] [A,B,C,D,E] [X,X,X,X,X,F] [A,B,C,D] [X,X,X,X,F,E] Till there is only first ..
Code: list=[0,1,2,3] for list[-1] in list: print(list) output: [0, 1, 2, 0] [0, 1, 2, 1] [0, 1, 2, 2] [0, 1, 2, 2] How is the last element of the list coming Source: Python..
I need to find the right index of X in list. Example for given list: [(0,1),(1,2),(2,3),(3,4)….]. The last X in a pair is the start index in the next pair (I can get also get pairs with "ugly" numbers but equally spaced). Now lets say i get x = 0.5, so i need to return ..
I have written these simple lines of code to get the current day name, and then using if/else statement wanted to check if it is the current day which is Sunday,and I should receive my if suite , because today is exactly Sunday, but the terminal gives me the else suite. I was wonder what ..