by insanitybit · 2y ago · 0 comments
from datetime import datetime, timedelta
# Current date
current_date = datetime(2023, 11, 1)
# Calculate the date 140 days from now
future_date = current_date + timedelta(days=140)
future_date.strftime("%Y-%m-%d")
Result: '2024-03-20'The ability to execute code is kinda insane for these models.
# Number of elephants total_elephants = 10
# Elephants with legs elephants_with_legs = total_elephants - 2
# Number of legs for an elephant legs_per_elephant = 4
# Total legs total_legs = elephants_with_legs * legs_per_elephant total_legs
Its actual response was correct.
This reminds me, I've had an alias for calc='python -ic "from math import *' for a long time now. It comes handy more often than you'd think.
or octave if you need some real power
You can even combine your pseudo language with natural language. See the OP’s custom GPT and the comments here: https://news.ycombinator.com/item?id=38594521
But is that actually output from a LLM, or is ChatGPT just running the Python code through a Python interpreter?