generated from jhudsl/OTTR_Template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scrap.qmd
65 lines (42 loc) · 1.22 KB
/
scrap.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
title: "Untitled"
format: revealjs
editor: visual
---
## Grammar Structure 3: Evaluation of Functions
A function has a **function name**, **input** **arguments**, and **returns** a data type.
::: callout-tip
## Execution rule for functions:
A function's input arguments, when there's more than one, can be specified by:
- The order the input given: `pow(2, 3)` is different than `pow(3, 2)`.
- The name of the input argument: `pow(base=2, exp=3)`.
If the arguments contain expressions, evaluate those expressions first!
:::
## Examples
```{python}
pow(2, 3)
```
```{python}
pow(base=2, exp=3)
```
```{python}
pow(exp=3, base=2)
```
. . .
```{python}
max(len("hello"), 4)
```
## Learning a new function
1. Function documentation
```
?pow
pow(base, exp, mod=None)
Equivalent to base**exp with 2 arguments or base**exp % mod with 3 arguments
Some types, such as ints, are able to use a more efficient algorithm when
invoked using the three argument form.
```
. . .
2. Documents page of a Python Module
[Base Python documentation of `pow`](https://docs.python.org/3/library/functions.html#pow)
. . .
3. Forums vetted by experts, such as [SlackOverflow](https://stackoverflow.com/questions/tagged/pow+python)