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
  Entry field random pull from list, each return own line Bear1981 6 908 Feb-25-2025, 06:09 AM
Last Post: Pedroski55
  Sample random, unique string pairs from a list without repetitions walterwhite 1 2,037 Nov-19-2023, 10:07 PM
Last Post: deanhystad
  How do you get Python to print just one value in a list? 357mag 3 2,255 May-17-2023, 09:52 PM
Last Post: rob101
  Delete strings from a list to create a new only number list Dvdscot 8 3,517 May-01-2023, 09:06 PM
Last Post: deanhystad
  find random numbers that are = to the first 2 number of a list. Frankduc 23 7,605 Apr-05-2023, 07:36 PM
Last Post: Frankduc
  List of random numbers astral_travel 17 5,931 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 2,970 Oct-23-2022, 11:13 PM
Last Post: Pedroski55
Question Finding string in list item jesse68 8 3,330 Jun-30-2022, 08:27 AM
Last Post: Gribouillis
  Print List to Terminal DaveG 2 2,220 Apr-02-2022, 11:25 AM
Last Post: perfringo
  how to easily create a list of already existing item CompleteNewb 15 6,386 Jan-06-2022, 12:48 AM
Last Post: CompleteNewb

Forum Jump:

User Panel Messages

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