Click here to Skip to main content
15,348,280 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
list1 = [5, 20, 15, 20, 25, 50, 20]

as you can see the list has been declared, now what I've must do is
1. remove all the elements valued at 20 and save them in the variable list2. After that print the variable list2.
2. from variable list 2. if has been found element valued at 15, changed to 10 and saved in the variable list3. also, print the list3
Sincerely, thanks before guys

What I have tried:

I have tried using function pops but it seems I just lost
Updated 11-Apr-22 17:00pm
Maciej Los 11-Apr-22 15:25pm
Sounds like homework.
What code have you tried to use?

from check out the index() operation
Check the nice article on list operation in Python. Try yourself to learn more:[^]
How to Remove Duplicates from a List in Python | Career Karma[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900