Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
random.choice HELP
#5
import random
array = ["Hello","Dog","Cat","Ball"]
x = random.choice(range(len(array)))
print(x, array[x])
Reply


Messages In This Thread
random.choice HELP - by samuelbachorik - Aug-08-2021, 10:52 AM
RE: random.choice HELP - by menator01 - Aug-08-2021, 10:58 AM
RE: random.choice HELP - by samuelbachorik - Aug-08-2021, 11:32 AM
RE: random.choice HELP - by deanhystad - Aug-08-2021, 01:25 PM
RE: random.choice HELP - by naughtyCat - Aug-18-2021, 03:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  combobox_callback(choice choice part of openfile name (kind of dependency) janeik 9 1,549 Sep-10-2023, 10:27 PM
Last Post: janeik
  Unable to use random.choice(list) in async method spacedog 4 3,505 Apr-29-2021, 04:08 PM
Last Post: spacedog
  Help with a random.randint choice in Python booponion 5 2,853 Oct-23-2020, 05:13 PM
Last Post: deanhystad
  trying to input a variable using random.choice python63 9 3,693 Aug-13-2020, 05:37 PM
Last Post: python63
  Random Choice Operations Souls99 6 2,983 Jul-31-2020, 10:37 PM
Last Post: Souls99
  random.choice() takes two positional arguments, but three were given. ShakeyPakey 5 11,814 May-31-2020, 03:13 PM
Last Post: deanhystad
  random.choice Sensing Nonexistent Argument Millionsunz 3 5,854 Nov-28-2016, 05:57 AM
Last Post: micseydel

Forum Jump:

User Panel Messages

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