Python Forum
How to get a random item from a list, print it and delete it? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to get a random item from a list, print it and delete it? (/thread-16308.html)



How to get a random item from a list, print it and delete it? - giorgosmarga - Feb-22-2019

Hi guys,
I have a question
Is there a way to get a random item from a list, print it and then delete the same random item from the list??


RE: lists - Yoriz - Feb-22-2019

Yes, look at the random module and list methods.


RE: lists - giorgosmarga - Feb-22-2019

(Feb-22-2019, 04:56 PM)Yoriz Wrote: Yes, look at the random module and list methods.
i am not sure that i can find it


RE: How to get a random item from a list, print it and delete it? - Yoriz - Feb-22-2019

Look in the python documentation.