# Functions - return

{% tabs %}
{% tab title="example.py" %}

```
def main():
  done = False
  while not done:
    print("Menu")
    print("D - Do Now")
    print("Q - Quit")
    print("e1 - Example1")
    print("e2 - Example2")
    print("e3 - Example3")
    print("p1 - Problem1")
    print("p2 - Problem2")
    print("p3 - Problem3")
    choice = input("Choice: ")
    if choice == "D":
        print("Do Now")
        base=int(input("Base?"))
        height=int(input("Height?"))
        donow(base,height)
    elif choice == "Q":
        print("Exiting Game!")
        done = True
    elif choice == "e1":
        base=int(input("Base?"))
        height=int(input("Height?"))
        area=e1(base,height)
        print(area)
    elif choice == "e2":
        base=int(input("Base?"))
        height=int(input("Height?"))
        length=int(input("Length?"))
        volume=e2(base,height,length)
        print(volume)
    elif choice == "e3":
        x1=int(input("x1?"))
        x2=int(input("x2?"))
        y1=int(input("y1?"))
        y2=int(input("y2?"))
        slope=e3(x1,x2,y1,y2)
        print(slope)

def donow(base,height):
  print (base*height*1/2)

def e1(base,height):
  return (base*height*1/2)

def e2(base,height,length):
  return (base*height*length)

def e3(x1,x2,y1,y2):
  return ((y2-y1)/(x2-x1))

main()

```

{% endtab %}

{% tab title="" %}

```python
def main():
  done = False
  while not done:
    print("Menu")
    print("D - Do Now")
    print("Q - Quit")
    print("e1 - Example 1")
    print("e2 - Example 2")
    print("e3 - Example 3")
    choice = input("Choice: ")
    if choice == "D":
        print("Do Now")
        base=int(input("Base?"))
        height=int(input("Height?"))
        donow(base,height)
    elif choice == "Q":
        print("Exiting Game!")
        done = True
    elif choice == "e1":
        base=int(input("Base?"))
        height=int(input("Height?"))
        area=e1(base,height)
        print(area)
    elif choice == "e2":
        base=int(input("Base?"))
        height=int(input("Height?"))
        length=int(input("Length?"))
        volume=e2(base,height,length)
        print(volume)
    elif choice == "e3":
        x1=int(input("x1?"))
        x2=int(input("x2?"))
        y1=int(input("y1?"))
        y2=int(input("y2?"))
        slope=e3(x1,x2,y1,y2)
        print(slope)

def donow(base,height):
  print (base*height*1/2)

def e1(base,height):
  return (base*height*1/2)

def e2(base,height,length):
  return (base*height*length)

def e3(x1,x2,y1,y2):
  return ((y2-y1)/(x2-x1))
  
main()

```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.pythonclassroom.com/functions/functions-return.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
