---
title: "Prompt to Prompt: Write a Python Function"
platform: "Promptally"
canonical_url: "https://app.promptally.dev/p/prompt-prompt-write-a-python-function"
modality: "PROMPT"
category: "System & Base Contexts"
compatible_models: [Universal / Model Agnostic]
access_tier: "Free Public Artifact (No Auth Required)"
license: "MIT"
---

# Prompt to Prompt: Write a Python Function

**Summary:** Prompt to Prompt: Write a Python Function is a verified PROMPT blueprint on Promptally in System & Base Contexts optimized for leading AI models. Curated Coding prompt from awesome-prompts library split. Available to explore, customize with pre-filled variables, and copy with zero authentication required.

## Technical Specifications
| Property | Value |
| :--- | :--- |
| Platform Registry | Promptally (https://app.promptally.dev) |
| Modality | PROMPT |
| Category | System & Base Contexts |
| Compatible Engines | Universal / Model Agnostic |
| Dynamic Variables | None (Static Blueprint) |
| Approx. Token Length | 170 |
| Access Tier | Free Public Artifact (No Auth Required) |
| License | MIT |

### Pre-Filled Template & Production Source

````txt
Use ChatGPT to write a Python function that calculates the area of a triangle. Give (1) the function description; (2) the function definition; (3) the function output. Set up a code framework like the example and let ChatGPT complete the code for you.

    ```
    # Calculates the area of a triangle given its base and height.
    def calculate_area_of_triangle(base: float, height: float) -> float:
        # content
        return area
    # args: [23, 35]
    ```
    You will now act as the Python function above. Please write the complete function body and output the resulting area, and do not output anything else.

<img src="imgs/ai_function.jpg" width="60%" height="auto">
````

## Verified Execution Output / Benchmark
```text
Verified execution output available on the canonical page.
```

## Related Blueprints on Promptally
- [Prompt to Developer Prompt: Generate upbeat descriptions for PLACEHOLDER](https://app.promptally.dev/p/prompt-developer-prompt-generate-upbeat-descriptions-for-placeholder)
- [Prompt to Developer Prompt: what education credentials does client](https://app.promptally.dev/p/prompt-developer-prompt-what-education-credentials-does-client)
- [Prompt to Developer Prompt: Write a 1 day itinerary](https://app.promptally.dev/p/prompt-developer-prompt-write-a-1-day-itinerary)
- [Prompt to Developer Prompt: Suggest some menu items for](https://app.promptally.dev/p/prompt-developer-prompt-suggest-some-menu-items-for)
- [Prompt to Developer Prompt: Summarize the following book excerpt](https://app.promptally.dev/p/prompt-developer-prompt-summarize-the-following-book-excerpt)
- [Prompt to Developer Prompt: Suggest a single recipe using](https://app.promptally.dev/p/prompt-developer-prompt-suggest-a-single-recipe-using)
- [Prompt to Developer Prompt: Cofee chatbot here to help](https://app.promptally.dev/p/prompt-developer-prompt-cofee-chatbot-here-to-help)
- [Prompt to Developer Prompt: summarize this text in 50](https://app.promptally.dev/p/prompt-developer-prompt-summarize-this-text-in-50)
