Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random selection
#5
#Import the random Module
import random

# Here are your list of Pirates
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']

# PRINT THE CONTENT OF THE PIRATES LIST TO THE SCREEN HERE
print '''Your List of Pirates are:

'''
for pirates in pirates:
    print pirates
#  Attacks List
attack = ['Dodge', 'Parry', 'Thrust']
print'''


'''
# PRINT THE CONTENTS OF THE ATTACK LIST TO THE SCREEN HERE
print '''Your Available Attacks are:

'''
for attack in attack:
    print attack
# Choosing the Characters for the fight
player = random.choice(pirates)
opponent = random.choice(pirates)





# #############################################################################
# Change the line below to correctly concatenate PLAYER and OPPONENT with
# the variables above so that when the statement prints to screen, the chosen
# character names are shown.
# #############################################################################

print "Ahoy ye swabs! Prepare for battle!"
print "PLAYER has challenged OPPONENT in one on one combat!"

# Choosing the attack
pattack = random.choice(attack)
oattack = random.choice(attack)

# CREATE A CORRECTLY CONCATENATED STRING THAT CONTAINS PLAYER, OPPONENT, PATTACK & OATTACK
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