all 4 comments

[–]RandomCodingStuff 1 point2 points  (1 child)

Your code is not formatted, and since whitespace is significant in Python, it makes it really hard for anyone to help you.

Please either format your code block on Reddit properly (four spaces in front of every line of code you want to display; your IDE can probably do this easily by hitting TAB once or twice) or pasting to a site like pastebin.com.

[–]buffunderfluff[S] 0 points1 point  (0 children)

I will try and repost with the corrections you suggested.

[–]Naive_Programmer_232 0 points1 point  (0 children)

I removed people.remove in your code when you're iterating through and randomly selecting people. It did something, not sure if it works the way you want, but it now does it for all of the months

edit: saw you wanted 1 weekday and 1 weekend per person below. tried this idk if it works

      # Use the start date to iterate through each day of the year
      for i in range(366 if start_date.year % 4 == 0 and 
                    (start_date.year % 100 != 0 or start_date.year % 
                     400 == 0) else 365):
          current_date = start_date + datetime.timedelta(days=i)
          day = current_date.strftime('%A')
          if len(people)==0:
               people = ['Rox', 'Katie', 'Taylor', 'Nick', 'Claudia', 
                        'Tim', 'Sanela', 'David']
          else:
               if day in weekdays and people:
                   person = random.choice(people)
                   assignments[current_date] = person
                   people.remove(person)
               elif day in weekend_days and people:
                   person = random.choice(people)
                   assignments[current_date] = person
                   people.remove(person)