How can i remove a word next to another one if the other one is in the list?(python) | Sololearn: Learn to code for FREE!
- 1

How can i remove a word next to another one if the other one is in the list?(python)

i have an input and i make it a list: input1=input() -> "rock paper scissor" ["rock", "paper", "scissor"] i have to make that if paper is in the list i delete the next word

31st Jan 2017, 3:38 PM
Guido Parlatore
Guido Parlatore - avatar
1 Odpowiedź
+ 1
loop in thru the list using for. suppose paper is found at the i postition delete the the item at i+1 position using del list[i+1]
11th Feb 2017, 11:09 AM
Madhurima Chakraborty
Madhurima Chakraborty - avatar