Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random selection
#1
I am taking a class and I am having trouble with one line of script. I have my List as follows:
pirates = [
    'Captain William Kidd',
    'Pierre Le Grand',
    'Red Leg Grieves',
    'Edward Low',
    'Calico Jack Rackham',
    'Anne Bonny',
    'Captain Henry Morgan',
    'Black Sam Bellamy',
    'Black Bart Roberts',
    'Edward Blackbeard Teach']
Then I have
player = random.choice(pirates)
opponent = random.choice(pirates)
what script do I use to print the player and opponent?
I have tried print player
?????
Reply


Messages In This Thread
Random selection - by EMarburg - Aug-11-2019, 11:43 PM
RE: Random selection - by boring_accountant - Aug-12-2019, 12:11 AM
RE: Random selection - by EMarburg - Aug-12-2019, 12:22 AM
RE: Random selection - by boring_accountant - Aug-12-2019, 12:48 AM
RE: Random selection - by EMarburg - Aug-12-2019, 01:02 AM
RE: Random selection - by boring_accountant - Aug-12-2019, 01:14 AM
RE: Random selection - by ichabod801 - Aug-12-2019, 01:15 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  random selection of song and artist not working Unknown_Relic 2 2,375 Nov-08-2019, 02:06 PM
Last Post: perfringo
  Random number selection stumunro 4 3,676 Aug-31-2017, 02:12 PM
Last Post: stumunro

Forum Jump:

User Panel Messages

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