Write code to tell me the first and third Thursday’s of every month.
- User
Write code to tell me the first and third Thursday’s of every month.
Assistant
import datetime # Function to get the first and third Thursday of a month def get_first_and_third_thursday(year, month): # Get the first Thursday of the month first_thursday = datetime.date(year, month, 1) while first_thursday.weekday() != 3: first_thursday += datetime.timedelta(days=1) # Get the third Thursday of the month third_thursday = first_thursday + datetime.timedelta(days=14) # Return the first and third Thursday return first_thursday, third_thursday # Get the first and third Thursday of the current month current_year = datetime.date.today().year current_month = datetime.date.today().month first_thursday, third_thursday = get_first_and_third_thursday(current_year, current_month) # Print the first and third Thursday print("First Thursday:", first_thursday) print("Third Thursday:", third_thursday)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.