File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -27,12 +27,13 @@ This module provides runtime support for type hints.
27
27
28
28
Consider the function below::
29
29
30
- def moon_weight(earth_weight : float) -> str:
31
- return f'On the moon, you would weigh {earth_weight * 0.166} kilograms.'
30
+ def surface_area_of_cube(edge_length : float) -> str:
31
+ return f"The surface area of the cube is {6 * edge_length ** 2}."
32
32
33
- The function ``moon_weight `` takes an argument expected to be an instance of :class: `float `,
34
- as indicated by the *type hint * ``earth_weight: float ``. The function is expected to
35
- return an instance of :class: `str `, as indicated by the ``-> str `` hint.
33
+ The function ``surface_area_of_cube `` takes an argument expected to
34
+ be an instance of :class: `float `, as indicated by the :term: `type hint `
35
+ ``edge_length: float ``. The function is expected to return an instance
36
+ of :class: `str `, as indicated by the ``-> str `` hint.
36
37
37
38
While type hints can be simple classes like :class: `float ` or :class: `str `,
38
39
they can also be more complex. The :mod: `typing ` module provides a vocabulary of
You can’t perform that action at this time.
0 commit comments