Python Forum
How to get a random item from a list, print it and delete it?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get a random item from a list, print it and delete it?
#1
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??
Reply
#2
Yes, look at the random module and list methods.
Reply
#3
(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
Reply
#4
Look in the python documentation.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Sample random, unique string pairs from a list without repetitions walterwhite 1 448 Nov-19-2023, 10:07 PM
Last Post: deanhystad
  How do you get Python to print just one value in a list? 357mag 3 1,006 May-17-2023, 09:52 PM
Last Post: rob101
  Delete strings from a list to create a new only number list Dvdscot 8 1,510 May-01-2023, 09:06 PM
Last Post: deanhystad
  find random numbers that are = to the first 2 number of a list. Frankduc 23 3,180 Apr-05-2023, 07:36 PM
Last Post: Frankduc
  List of random numbers astral_travel 17 2,690 Dec-02-2022, 10:37 PM
Last Post: deanhystad
  [split] why can't i create a list of numbers (ints) with random.randrange() astral_travel 7 1,505 Oct-23-2022, 11:13 PM
Last Post: Pedroski55
Question Finding string in list item jesse68 8 1,858 Jun-30-2022, 08:27 AM
Last Post: Gribouillis
  Print List to Terminal DaveG 2 1,430 Apr-02-2022, 11:25 AM
Last Post: perfringo
  how to easily create a list of already existing item CompleteNewb 15 3,523 Jan-06-2022, 12:48 AM
Last Post: CompleteNewb
  Remove an item from a list contained in another item in python CompleteNewb 19 5,661 Nov-11-2021, 06:43 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020