Well, there are thousands of tricks which can be performed using python. So, here I’m bringing one more python trick for you’ll.
Okay, but the condition is that you don’t have to use your terminal for answering this question, yes, because it’s an easy one. So you just don’t need a terminal at all.
This is simple trick in python related to “greater than” or “less than” which we all studied in junior classes and we’ll did it correctly.
So, its time to remember those days and try to find out the correct answer of the python program.
Here is the code :
some_list = [1, 2, 3, 4, 5, 6] for item in some_list: if item < 4: some_list.remove(item) print some_list
Problem looks easy ? Okay, try figuring out the answer without using a python interpretor.