← Lesson
Tokens, Tools, and Goals
Joeven
Run
Reset
Python loads on first run
def goal_satisfied(ticket): url = ticket.get("url", "") body = ticket.get("body", "") has_url = url.startswith("https://") has_test = "def test_" in body return has_url and has_test good = { "url": "https://github.com/x/y/issues/3", "body": "def test_login():\n assert True", } bad = {"url": "", "body": "please fix"} print("good ticket:", goal_satisfied(good)) print("empty ticket:", goal_satisfied(bad)) print("url ok only:", goal_satisfied({"url": "https://example.com", "body": "no test"})) print("test ok only:", goal_satisfied({"url": "http://x", "body": "def test_x(): pass"}))
Run to execute this in your browser. Nothing is sent to a server.