Linked Questions

0 votes
1 answer
7k views

I was trying to sort a list using for loops in python. I wrote the code like this. L=[1,2,3,6,7,9,4] NL=[] for i in L: NL.append(min(L)) L.remove(min(L)) print(NL) But here the output is [...
Proton's user avatar
  • 35
1 vote
5 answers
188 views

I'm trying to make a program that deleted all vowels from a string but for some reason it is not working. Here is my code in python 3 s = list(input()) vowels = ["A", "E", "I&...
user13486304's user avatar
0 votes
1 answer
3k views

I know this is a basic question but here it's weird. I have no idea why this is giving the error. plz help me with this. Thanks in advance arr = [11,22,33,44,55,66,77] brr = [1,2,3,4,55] res_arr = ...
nnnnn's user avatar
  • 89
1 vote
2 answers
1k views

My requirement is to delete the row having any element with text "Podcast" . audio is list of lists of xml elements for i in range(len(audio)): for j in range(len(audio[i])): ...
Leo's user avatar
  • 908
0 votes
2 answers
1k views

Hi I have this task in python and I should remove all not int elements, the result of the code down below is [2, 3, 1, [1, 2, 3]] and I have no idea why in the result the list is not moved away. Only ...
Joji Ddan's user avatar
0 votes
4 answers
1k views

I have a list such as this: l = ['(7 - 3)', '7 - 6', '(a + 13)'] I want to remove any expression that does NOT contain the letter "a" therefore the only expression that would be left is ['(a+13)']. ...
user avatar
2 votes
3 answers
1k views

Possible Duplicate: Remove items from a list while iterating in Python I have a fairly embedded list: specifically, it is a list of lists of tuples. To simplify things, the entire list is a list ...
Adam_G's user avatar
  • 7,979
0 votes
5 answers
307 views

I am quite new to python and trying to remove some duplicates from a list following below code. I am getting a list index out of range error which doesn't make sense to me. Thankful for any advice. ...
Kevin's user avatar
  • 51
2 votes
3 answers
2k views

I have a list of tuples, all contain 1 phrase and 1 number. Example: [('light blue', 3), ('light green', 4), ('blue shade', 2), ('deep red', 3), ('dark red')] I would like to remove tuples from the ...
Enikő Várkonyi's user avatar
0 votes
1 answer
2k views

I have a nested list that I would like to delete rows after it has finished with them. i tried using enumerating to pass in the index of the row to delete. nlist = [['Chris', 'Davids', 21], ['Rob', '...
Mantis's user avatar
  • 1,407
0 votes
2 answers
1k views

I am confused about a really simple problem with list built-in function, pop. The code is simple as it can be. L=[1,2] for i in L: print i L.pop(0) and it gives 1 I tried it with a longer ...
Jimmy Suh's user avatar
  • 212
0 votes
2 answers
2k views

I have created a list full of "coordinates" in Python: L1 = [(1,2), (5,6), (-1,-2), (1,-2), etc..]. If I wanted to remove all items in the list which contained negative numbers, how would I do this? ...
user avatar
0 votes
1 answer
591 views

My code: ipList = ["192.168.0.1", "sg1234asd", "1.1.1.1", "test.test.test.test"] blackList = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "...
codaamok's user avatar
  • 765
1 vote
2 answers
1k views

Background: I am writing a little script which requires, as one of it's arguments, an email address list in a file. The script will them go on to use the email address over a telnet connection to an ...
FiddleDeDee's user avatar
0 votes
3 answers
476 views

I have nested list like that [a,1],[b,2],[c,3] My code: for i in list: if i[0] == 'b': del i And thats just not working. Code do not crash, but it does not delete neither. I was trying ...
c0rv's user avatar
  • 37

15 30 50 per page
1 2
3
4 5
59