Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random selection
#7
I believe the problem is line 21: for pirates in pirates:. You use the plural form for both the looping variable and the thing looped over. So at the end, pirates is equal to the last pirate: 'Edward Blackbeard Teach'. So you should switch that loop to:

for pirate in pirates:
    print pirates
You should also switch to Python 3. At the end of the year support for 2.7 will stop.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
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,355 Nov-08-2019, 02:06 PM
Last Post: perfringo
  Random number selection stumunro 4 3,649 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