Questions tagged [remove-method]

34 questions
-1
votes
1 answer

Remove Multiple Elements in a Python List Once

(Using Python 3) Given this list named numList: [1,1,2,2,3,3,3,4]. I want to remove exactly one instance of “1” and “3” from numList. In other words, I want a function that will turn numList into: [1,2,2,3,3,4]. What function will let me remove an X…
thisLexic
  • 43
  • 2
  • 8
-1
votes
3 answers

Java applet throws error in remove object from Iterator array

Welcome, i am programming a simple RPG game in java applet. It is getting more and more complicated and many errors are thrown to my face. Today i have problem with .remove(); method. Exception in thread "AWT-EventQueue-1"…
-5
votes
2 answers

how to remove composite numbers from a list in python 3?

I am not able to remove composite numbers from a list in python 3 .Can you help? Example input: list1 = [2, 3, 6, 7, 14, 21, 23, 42, 46, 69, 138, 161, 322, 483] Expected output: list1 = [2, 3, 7, 23] Thanks in advance.
-7
votes
3 answers

How to write a remove method?

Write a method called get which will return an element from the given index. Returns -1 if the index is out-of-bounds. Write a method called remove which will remove an element from the given index. Returns -1 if the index is out-of-bounds. Data…
S K
  • 1
  • 1
  • 3
1 2
3