-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathutils.py
More file actions
28 lines (22 loc) · 705 Bytes
/
Copy pathutils.py
File metadata and controls
28 lines (22 loc) · 705 Bytes
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
#!/usr/bin/env python3
"""Utility functions for math operations."""
def add_numbers(a, b):
"""Add two numbers and return the result."""
return a + b
def multiply_numbers(a, b):
"""Multiply two numbers and return the result."""
return a * b
class MathClass:
"""A class for various math operations."""
def square(self, n):
"""Return the square of a number."""
return n * n
def cube(self, n):
"""Return the cube of a number."""
return n * n * n
def factorial(self, n):
"""Return the factorial of a number."""
if n == 0 or n == 1:
return 1
else:
return n * self.factorial(n - 1)