forked from cassidymwagner/poa_grads_git_demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy_python_functions.py
58 lines (49 loc) · 1.21 KB
/
my_python_functions.py
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
import numpy as np
def calc_mean(x):
"""Calculate the mean of an array of numbers.
Parameters
----------
x : array-like
The array of numbers for which the mean is calculated.
Returns
-------
mean : float
The mean of the input array of numbers.
"""
return np.mean(x)
def calc_median(x: np.ndarray) -> float:
"""Calculate the median of an array of numbers.
Parameters
----------
x : array-like
The array of numbers for which the median is calculated.
Returns
-------
median : float
The median of the input array of numbers.
"""
return np.median(x)
def calc_std(x):
return np.std(x)
def calc_add(x, y):
"""Calculate the sum of two numbers.
Parameters
----------
x : float
The first number.
y : float
The first number.
Returns
-------
sum : float
The sum of the two input numbers.
"""
return x + y
def calc_sub(x, y):
return x - y
def print_my_name(name):
if not isinstance(name, str):
raise ValueError("The input must be a string.")
print("Hello, my name is", name)
def print_something_nice():
print("You are doing a great job!")