Python Forum
Help with a schedule maker
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with a schedule maker
#1
Im new to python but have gone over a couple beginners guide, but I have a project due soon and i'm not sure how to begin programing it.

I have to make a schedule maker for beach lifeguards. All the program would have to do is to randomly put pre entered names onto pre entered beaches, and next to it it would give two random days off. This doesn't have to be a complex solution but if anyone has any idea how to begin programing this or any advice it would be much appreciated.

It would look something like
Main beach- John- Mon, Wed
Main beach- Marry, Sat, Sun
Side beach- Jake- Mon, Fri
Reply
#2
To get two random days use random.sample, to get one random name use random.choice:

import random
print(random.choice(['John', 'Mary', 'Jake', "Bob"])
print(random.sample(['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri, 'Sat'], 2))
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Forum Jump:

User Panel Messages

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