Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sorting end results
#1
Im am creating a schedule maker and am having trouble sorting the end results in an easy to read format. It's only processing from 3 different lists. 'lifeguard' 'Beach' and 'day_off' so does anyone know how to have it sort with names with the same beaches so it would look something like this
(beach 1)(lifeguard 1)(day_off)(day_off).
(beach 1)(lifeguard 2)(day_off)(day_off)
(beach 2)(lifeguard 3)(day_off)(day_off)
This is what I have

import time
import random

beach = ['Civic','Middle', '2 Chair', 'Main', 'Malibu', 'Nassau 2', 'Nassau 5', 'Reef', 'Anchor', 'E.lido', 'Lido', 'W.Lido', 'Surfing Bay', 'Lido West', 'EAB', 'E.EAB', 'Sea Glades']
lifeguard = ['Rodriguez','Mills', 'L Fitzgerald', 'Laibach', 'Hannon', 'Ruddick', 'Pitzer', 'TFlannigann', 'Vurro', 'Harrington', 'Chase', 'Clarkson', 'Digregorio', 'Nicharkwick', 'Riobo', 'Czartoyski', 'Meringolo', 'Brady', 'Barklow', 'Treadwell', 'Flynn', 'Geodecke', 'Murphy', 'Spinella', 'Joyce', 'TFitzgerald', 'Dreidy', 'EMquade', 'Schroeder', 'Mcveigh', 'Harloff', 'Rtreadwell', 'Cdauria', 'Ochs', 'Mriordan', 'Scibelli', 'Shanley', 'Charkowick', 'Kappel', 'Shutkind', 'Tcrafa', 'BCreigh', 'JCrafa', 'Creagh', 'Fitzpatrick', 'Curry', 'KFlannigan', 'Schlicte', 'Aicher', 'Kinneally', 'CCrafa', 'Fahy', 'Mulloolly', 'Zimmerman', 'Marcote', 'Kluss', 'Wiets', 'Duaria', 'PMquade', 'Campbell', 'Ptucker', 'Henderson', 'Lupia', 'Dunn', 'Rainus', 'lark', 'Peers', 'TLark',  'Martinez', 'Scheinburg', 'Rainus', 'Techera', 'Mcglughlin', 'Carr', 'Farrel', 'Bergin', 'Demeo', 'Trebel', 'Vanella', 'Serrao', 'Brown', 'Paoli', 'Dilsner', 'Swanson', 'JBurns', 'Stapleton', 'Correa', 'Formes', 'Hurst', 'BHarrington', 'Marks', 'MByrne', 'Boccio', 'Neuwieth', 'Babel', 'Hooker', 'Orourke', 'Martinsen', 'Leone', 'Wiessburg', 'Compton', 'Mazur', 'Tucker', 'Kerr', 'Dunster', 'Hutchinson', 'TFahy', 'Giordana', 'Hughes', 'Mahony', 'Gallego', 'CoNewby', 'Vitale', 'Shineburg', 'Longo', 'Michelman', 'Henne']
days_off = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
for i in lifeguard:
        random.shuffle(lifeguard)
        win = lifeguard.pop()
        print (" %s" % win)
        random.shuffle(beach)
        win = beach[1]
        print (" %s" % win)
        random.shuffle(days_off)
        win = days_off[:2]
        print (" %s" % win)
        print("--------------")

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Search Results Web results Printing the number of days in a given month and year afefDXCTN 1 2,245 Aug-21-2020, 12:20 PM
Last Post: DeaD_EyE
  How to append one function1 results to function2 results SriRajesh 5 3,179 Jan-02-2020, 12:11 PM
Last Post: Killertjuh
  Sorting a copied list is also sorting the original list ? SN_YAZER 3 3,082 Apr-11-2019, 05:10 PM
Last Post: SN_YAZER

Forum Jump:

User Panel Messages

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