Prompt to Prompt: Write a Python Function
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
| Specification | Value |
|---|---|
| Artifact type | PROMPT (System & Base Contexts) |
| Compatible engines | Universal / Model Agnostic |
| Input variables | None (pre-filled) |
| Approximate tokens | 170 |
| Source file | prompt-prompt-write-a-python-function.txt |
| Access tier | Free public (MIT) |
Pre-Filled Template
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">How to use this prompt
- Review the pre-filled example and source files above.
- Copy the template or download
prompt-prompt-write-a-python-function.txt, then use it in your model, IDE, or workflow tool. - Compare your result with the sample output when one is provided.
Frequently Asked Questions
How do I use Prompt to Prompt: Write a Python Function?
Open the prompt on Promptally, review the pre-filled example, then copy the template or download prompt-prompt-write-a-python-function.txt and paste it into your model, IDE or workflow tool. Prompt to Prompt: Write a Python Function is a static blueprint with no dynamic variables. Copy it and use it as-is.
Is Prompt to Prompt: Write a Python Function free?
Yes. Prompt to Prompt: Write a Python Function is free to view, copy and download on Promptally without creating an account. It is published under the MIT license.
What variables does Prompt to Prompt: Write a Python Function need?
Prompt to Prompt: Write a Python Function is a static blueprint with no dynamic variables. Copy it and use it as-is.