> For the complete documentation index, see [llms.txt](https://www.pythonclassroom.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.pythonclassroom.com/math/math-problems.md).

# Math Problems

## Problem 1

print("Problem 1 - Rectangle Area")

Assign 5 to the variable l and 7 to variable w. Assign the variable Area according to the formula:

$$
Area=lw
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-LjxbN_Un-wDdmW9jGLv%2FScreen%20Shot%202019-07-16%20at%209.47.58%20PM.png?alt=media\&token=5b7d95e9-c635-4ca9-be06-588c25e77047)

Print the value of Area.

## Problem 2

print("Problem 2 - Square Area")

Assign 11 to the variable a. Assign the variable Area according to the formula:

$$
Area=a^2
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-LjxbuTzjID0iLrnQG-e%2FScreen%20Shot%202019-07-16%20at%209.50.16%20PM.png?alt=media\&token=d0015a53-6868-4622-8112-a21e42e14da0)

Print the value of Area.

## Problem 3

print("Problem 3 - Circle")

Assign 5 to the variable r. Assign the variable Area and Circumference according to the formula. Print the value of Area and Circumference. &#x20;

{% hint style="info" %}
To access the value of pi, import the Python math library
{% endhint %}

```python
import math # put this on line 1
print(math.pi) # this is the value of pi
```

$$
Area=πr^2
$$

$$
Circumference = 2πr
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-LjxcNoBnM5D6Jf5dSiP%2FScreen%20Shot%202019-07-16%20at%209.51.01%20PM.png?alt=media\&token=70078db6-421d-44e0-a469-a2ea80744423)

Print the value of Area and Circumference.

## Problem 4

print("Problem 4 - Triangle Area")

Assign 11 to the variable b and 5 to the variable h. Assign the variable Area according to the formula.

$$
Area=\frac{1}{2} bh
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-LjxfWeirl0GoqKT6bYO%2FScreen%20Shot%202019-07-16%20at%2010.05.56%20PM.png?alt=media\&token=cc329279-a0e0-4abb-9d9e-f732ed58da9d)

Print the value of Area.

## Problem 5

print("Problem 5 - Parallelogram Area")

Assign 5 to the variable b and 13 to the variable h. Assign the variable Area according to the formula.

$$
Area=bh
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-Ljxftuaypg4VSMF7bAU%2FScreen%20Shot%202019-07-16%20at%2010.07.15%20PM.png?alt=media\&token=16c48b80-58b4-4994-8b9a-b953a67f628f)

Print the value of Area.

## Problem 6

print("Problem 6 - Trapezoid Area")

Assign 10 to h, 7 to a and 9 to b. Assign the variable Area according to the formula:

$$
Area=h\frac{a+b}{2}
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-LjxgKMQW08QbDLi5sL_%2FScreen%20Shot%202019-07-16%20at%2010.09.37%20PM.png?alt=media\&token=80b4ae64-6137-4669-af0e-6df79c790b3c)

Print the value of Area.

## Problem 7

print("Problem 7 - Kite Area")

Assign 8 to p and 9 to q.

$$
A=\frac{pq}{2}
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-LpyODfvd8oAVziQ8jLj%2F-LpyOwAn-5hysxyuFrsq%2FScreen%20Shot%202019-09-29%20at%203.02.46%20PM.png?alt=media\&token=5cbcfbe9-c16d-4128-90f0-32a1f6c82ad9)

## Problem 8

print("Problem 8 - Rectangular Prism Volume")

Assign 7 to l, 4 to w and 5 to h. Assign the variable Volume according to the formula:

$$
Volume=lwh
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-LjxgfLFjqLqu2gBwt9w%2FScreen%20Shot%202019-07-16%20at%2010.11.05%20PM.png?alt=media\&token=27fe1163-c859-4fb8-9cdc-af2a4f49a233)

Print the value of Volume.

## Problem 9

print("Problem 9 - Cube Volume")

Assign 13 to a. Assign the variable Volume according to the formula:

$$
Volume = a^3
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-Ljxgugi0v-dVkQzqifw%2FScreen%20Shot%202019-07-16%20at%2010.12.11%20PM.png?alt=media\&token=5f95c547-fec0-40cb-b195-c7bb40937ae3)

Print the value of Volume.

## Problem 10

print("Problem 10 - Pyramid Volume")

Assign 6 to l, 9 to w and 8 to h. Assign the variable Volume according to the formula:

$$
V=\frac{lwh}{3}
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-Ljxh3oHjyXFNt50lQz6%2FScreen%20Shot%202019-07-16%20at%2010.12.43%20PM.png?alt=media\&token=df7d071e-2688-496b-9947-28a6f776752d)

Print the value of Volume.

## Problem 11

print("Problem 11 - Cylinder Volume")

Assign 13 to r, 4 to h. Assign the variable Volume according to the formula.

$$
Volume=πr^2h
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-LjxhOAdeOFkpIsVPDLk%2FScreen%20Shot%202019-07-16%20at%2010.14.12%20PM.png?alt=media\&token=49901914-a61a-41d5-bb45-18d9ee323075)

Print the value of Volume.

## Problem 12

print("Problem 12 - Sphere Volume")

Assign 9 to r. Assign the variable Volume according to the formula.

$$
Volume=\frac{4}{3}\pi r^3
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-LjxhcEF6K0FilKcnFPK%2FScreen%20Shot%202019-07-16%20at%2010.15.12%20PM.png?alt=media\&token=626a298b-e08d-4320-bddc-70cae48ab8f2)

Print the value of Volume.

## Problem 13

print("Problem 13 - Cone Volume")

Assign 5 to r and 12 to h. Assign the variable Volume according to the formula.

$$
Volume=\pi r^2\frac{h}{3}
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-LjxhpC45-k49DZUK4hj%2FScreen%20Shot%202019-07-16%20at%2010.16.01%20PM.png?alt=media\&token=6eb727dc-93cf-4919-abc5-32f19264a183)

Print the value of Volume.

## Problem 14

print("Problem 14 - Rectangular Solid Surface Area")

Assign 11 to l, 12 to w and 13 to h. Assign the variable SA according to the formula:

$$
SA=2(wl+hl+hw)
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-Ljxi1edung1i2KtA2wL%2FScreen%20Shot%202019-07-16%20at%2010.17.04%20PM.png?alt=media\&token=273e7417-7e43-4733-812d-3d1cf309792a)

Print the value of SA.

## Problem 15

print("Problem 15 - Cube Surface Area")

Assign 14 to a. Assign the variable Area according to the formula.

$$
Area=6a^2
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-LjxiEd9gFONR5QnnLd6%2FScreen%20Shot%202019-07-16%20at%2010.17.54%20PM.png?alt=media\&token=3b35d345-0271-47d1-bc73-4f1892ecfee6)

Print the value of SA.

## Problem 16

print("Problem 16 - Sphere Surface Area")

Assign 15 to r. Assign the variable SA according to the formula.

$$
SA=4πr^2
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-LjxiT6R48mexufdeUSC%2FScreen%20Shot%202019-07-16%20at%2010.18.54%20PM.png?alt=media\&token=c5731dc7-9d4e-47e1-a2b3-3697243809aa)

Print the value of SA.

## Problem 17

print("Problem 17 - Right Cylinder Surface Area")

Assign 9 to r. Assign 6 to h. Assign the variable SA according to the formula:

$$
SA=2πrh+2πr^2
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-LjxikH_8lQ4kVp8E10E%2FScreen%20Shot%202019-07-16%20at%2010.20.03%20PM.png?alt=media\&token=5a7367ab-7f17-404b-9737-0c5ecb86145b)

Print the Area.

## Problem 18

print("Problem 18 - Triangular Prism Surface Area")

Assign 5 to b. Assign 3 to h. Assign 9 to l. Assign 5 to s. Assign the variable SA according to the formula.

$$
SA=bh+2ls+lb
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-Ljxb3SLFVhtF9Mq0vU2%2F-LjxjEyBVsP_09-5M6Pv%2FScreen%20Shot%202019-07-16%20at%2010.22.21%20PM.png?alt=media\&token=93548130-f177-43eb-aa17-87ed31f7a42c)

Print the value of SA.

## Problem 19

print("Problem 19 - Tetrahedron Surface Area")

Assign 9 to a.  Assign the variable SA according to the formula.

$$
SA=\sqrt3 a^2
$$

Print the value of SA.

{% hint style="info" %}
To take the square root of a number, use the math library.
{% endhint %}

```python
import math
math.sqrt(3)
```

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-LpyODfvd8oAVziQ8jLj%2F-LpyQou6nKzSwQyyfnxV%2FScreen%20Shot%202019-09-29%20at%203.10.52%20PM.png?alt=media\&token=1f5aad22-dcf4-4369-baf2-a30a68b66c20)

## Problem 20

print("Problem 20 - Tetrahedron Volume")

Assign 13 to a.  Assign the variable Volume according to the formula.

$$
Volume=\frac{a^3}{6\sqrt2}
$$

![](https://729613953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LVVKHMnpflHwghmbdgi%2F-LpyR8YUO1eBVrAjeyy6%2F-LpyRGFR8KJUIKBtf8_6%2FScreen%20Shot%202019-09-29%20at%203.10.52%20PM.png?alt=media\&token=1ebbc60c-b7cd-48a4-b391-006c3c5ea9b6)

Print the value of Volume.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.pythonclassroom.com/math/math-problems.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
